use libimagstore::store::Entry;
use libimagstore::storeid::StoreId;
pub trait IsInDiary {
fn is_in_diary(&self, name: &str) -> bool;
fn is_a_diary_entry(&self) -> bool;
}
impl IsInDiary for Entry {
fn is_in_diary(&self, name: &str) -> bool {
self.get_location().clone().is_in_diary(name)
}
fn is_a_diary_entry(&self) -> bool {
self.get_location().clone().is_a_diary_entry()
}
}
impl IsInDiary for StoreId {
fn is_in_diary(&self, name: &str) -> bool {
debug!("Check: is in diary '{}'", name);
self.is_in_collection(&["diary", name])
}
fn is_a_diary_entry(&self) -> bool {
self.is_in_collection(&["diary"])
}
}