libimaglog: Replace read with typed read

This commit is contained in:
Matthias Beyer 2018-01-12 16:31:41 +01:00
parent f2b72f4738
commit 014b54ad4e
1 changed files with 2 additions and 7 deletions

View File

@ -21,11 +21,10 @@ use libimagdiary::entry::DiaryEntry;
use libimagstore::store::Entry;
use error::LogError as LE;
use error::LogErrorKind as LEK;
use error::Result;
use toml::Value;
use toml_query::read::TomlValueReadExt;
use toml_query::read::TomlValueReadTypeExt;
use toml_query::insert::TomlValueInsertExt;
pub trait Log : DiaryEntry {
@ -35,11 +34,7 @@ pub trait Log : DiaryEntry {
impl Log for Entry {
fn is_log(&self) -> Result<bool> {
let location = "log.is_log";
self.get_header()
.read(location)?
.ok_or(LE::from_kind(LEK::HeaderTypeError("boolean", location)))
.map(|v| v.as_bool().unwrap_or(false))
self.get_header().read_bool("log.is_log").map(|v| v.unwrap_or(false)).map_err(From::from)
}
fn make_log_entry(&mut self) -> Result<()> {