imag/libimagdiary/src/is_in_diary.rs

27 lines
476 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 {
use std::path::PathBuf;
self.is_in_collection(&PathBuf::from(format!("diary/{}", name)))
2016-04-22 13:48:59 +00:00
}
}