libimaglog: Replace read with typed read
This commit is contained in:
parent
f2b72f4738
commit
014b54ad4e
1 changed files with 2 additions and 7 deletions
|
@ -21,11 +21,10 @@ use libimagdiary::entry::DiaryEntry;
|
||||||
use libimagstore::store::Entry;
|
use libimagstore::store::Entry;
|
||||||
|
|
||||||
use error::LogError as LE;
|
use error::LogError as LE;
|
||||||
use error::LogErrorKind as LEK;
|
|
||||||
use error::Result;
|
use error::Result;
|
||||||
|
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use toml_query::read::TomlValueReadExt;
|
use toml_query::read::TomlValueReadTypeExt;
|
||||||
use toml_query::insert::TomlValueInsertExt;
|
use toml_query::insert::TomlValueInsertExt;
|
||||||
|
|
||||||
pub trait Log : DiaryEntry {
|
pub trait Log : DiaryEntry {
|
||||||
|
@ -35,11 +34,7 @@ pub trait Log : DiaryEntry {
|
||||||
|
|
||||||
impl Log for Entry {
|
impl Log for Entry {
|
||||||
fn is_log(&self) -> Result<bool> {
|
fn is_log(&self) -> Result<bool> {
|
||||||
let location = "log.is_log";
|
self.get_header().read_bool("log.is_log").map(|v| v.unwrap_or(false)).map_err(From::from)
|
||||||
self.get_header()
|
|
||||||
.read(location)?
|
|
||||||
.ok_or(LE::from_kind(LEK::HeaderTypeError("boolean", location)))
|
|
||||||
.map(|v| v.as_bool().unwrap_or(false))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_log_entry(&mut self) -> Result<()> {
|
fn make_log_entry(&mut self) -> Result<()> {
|
||||||
|
|
Loading…
Reference in a new issue