imag/libimagdiary/src/is_in_diary.rs

26 lines
419 B
Rust
Raw Normal View History

2016-04-22 13:48:59 +00:00
use libimagstore::store::Entry;
use libimagstore::storeid::StoreId;
2016-04-22 13:48:59 +00:00
pub trait IsInDiary {
fn is_in_diary(&self, name: &str) -> bool;
}
impl IsInDiary for Entry {
fn is_in_diary(&self, name: &str) -> bool {
self.get_location().clone().is_in_diary(name)
2016-04-22 13:48:59 +00:00
}
}
impl IsInDiary for StoreId {
2016-04-22 13:48:59 +00:00
fn is_in_diary(&self, name: &str) -> bool {
self.is_in_collection(&["diary", name])
2016-04-22 13:48:59 +00:00
}
}