Fix libimagdiary::{diaryid, diary, is_in_diary}::* for new StoreId interface
This commit is contained in:
parent
63aa16de4e
commit
ff89111d47
3 changed files with 7 additions and 7 deletions
|
@ -45,8 +45,8 @@ impl<'a> Diary<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn retrieve(&self, id: DiaryId) -> Result<Entry> {
|
pub fn retrieve(&self, id: DiaryId) -> Result<Entry> {
|
||||||
self.store
|
id.into_storeid()
|
||||||
.retrieve(id.into_storeid())
|
.and_then(|id| self.store.retrieve(id))
|
||||||
.map(|fle| Entry::new(fle))
|
.map(|fle| Entry::new(fle))
|
||||||
.map_err(|e| DE::new(DEK::StoreWriteError, Some(Box::new(e))))
|
.map_err(|e| DE::new(DEK::StoreWriteError, Some(Box::new(e))))
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use chrono::Timelike;
|
||||||
|
|
||||||
use libimagstore::storeid::StoreId;
|
use libimagstore::storeid::StoreId;
|
||||||
use libimagstore::storeid::IntoStoreId;
|
use libimagstore::storeid::IntoStoreId;
|
||||||
|
use libimagstore::store::Result as StoreResult;
|
||||||
|
|
||||||
use module_path::ModuleEntryPath;
|
use module_path::ModuleEntryPath;
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ impl Default for DiaryId {
|
||||||
|
|
||||||
impl IntoStoreId for DiaryId {
|
impl IntoStoreId for DiaryId {
|
||||||
|
|
||||||
fn into_storeid(self) -> StoreId {
|
fn into_storeid(self) -> StoreResult<StoreId> {
|
||||||
let s : String = self.into();
|
let s : String = self.into();
|
||||||
ModuleEntryPath::new(s).into_storeid()
|
ModuleEntryPath::new(s).into_storeid()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use libimagstore::store::Entry;
|
use libimagstore::store::Entry;
|
||||||
|
use libimagstore::storeid::StoreId;
|
||||||
|
|
||||||
pub trait IsInDiary {
|
pub trait IsInDiary {
|
||||||
|
|
||||||
|
@ -11,12 +10,12 @@ pub trait IsInDiary {
|
||||||
impl IsInDiary for Entry {
|
impl IsInDiary for Entry {
|
||||||
|
|
||||||
fn is_in_diary(&self, name: &str) -> bool {
|
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 {
|
fn is_in_diary(&self, name: &str) -> bool {
|
||||||
self.to_str().map(|s| s.contains(name)).unwrap_or(false)
|
self.to_str().map(|s| s.contains(name)).unwrap_or(false)
|
||||||
|
|
Loading…
Reference in a new issue