diff --git a/libimagdiary/src/diary.rs b/libimagdiary/src/diary.rs index 40eaca88..de8571f9 100644 --- a/libimagdiary/src/diary.rs +++ b/libimagdiary/src/diary.rs @@ -45,8 +45,8 @@ impl<'a> Diary<'a> { } pub fn retrieve(&self, id: DiaryId) -> Result { - self.store - .retrieve(id.into_storeid()) + id.into_storeid() + .and_then(|id| self.store.retrieve(id)) .map(|fle| Entry::new(fle)) .map_err(|e| DE::new(DEK::StoreWriteError, Some(Box::new(e)))) } diff --git a/libimagdiary/src/diaryid.rs b/libimagdiary/src/diaryid.rs index 2cbdce56..74c78309 100644 --- a/libimagdiary/src/diaryid.rs +++ b/libimagdiary/src/diaryid.rs @@ -9,6 +9,7 @@ use chrono::Timelike; use libimagstore::storeid::StoreId; use libimagstore::storeid::IntoStoreId; +use libimagstore::store::Result as StoreResult; use module_path::ModuleEntryPath; @@ -118,7 +119,7 @@ impl Default for DiaryId { impl IntoStoreId for DiaryId { - fn into_storeid(self) -> StoreId { + fn into_storeid(self) -> StoreResult { let s : String = self.into(); ModuleEntryPath::new(s).into_storeid() } diff --git a/libimagdiary/src/is_in_diary.rs b/libimagdiary/src/is_in_diary.rs index 0d0cfccb..dfdd7169 100644 --- a/libimagdiary/src/is_in_diary.rs +++ b/libimagdiary/src/is_in_diary.rs @@ -1,6 +1,5 @@ -use std::path::PathBuf; - use libimagstore::store::Entry; +use libimagstore::storeid::StoreId; pub trait IsInDiary { @@ -11,12 +10,12 @@ pub trait IsInDiary { impl IsInDiary for Entry { fn is_in_diary(&self, name: &str) -> bool { - self.get_location().is_in_diary(name) + self.get_location().clone().is_in_diary(name) } } -impl IsInDiary for PathBuf { +impl IsInDiary for StoreId { fn is_in_diary(&self, name: &str) -> bool { self.to_str().map(|s| s.contains(name)).unwrap_or(false)