Add another small helper

This commit is contained in:
Matthias Beyer 2017-08-29 10:52:22 +02:00
parent 95b7da1ed2
commit 31fa07d43a

View file

@ -24,6 +24,8 @@ pub trait IsInDiary {
fn is_in_diary(&self, name: &str) -> bool; fn is_in_diary(&self, name: &str) -> bool;
fn is_a_diary_entry(&self) -> bool;
} }
impl IsInDiary for Entry { impl IsInDiary for Entry {
@ -32,6 +34,10 @@ impl IsInDiary for Entry {
self.get_location().clone().is_in_diary(name) 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 { impl IsInDiary for StoreId {
@ -40,5 +46,9 @@ impl IsInDiary for StoreId {
self.local().starts_with(format!("diary/{}", name)) self.local().starts_with(format!("diary/{}", name))
} }
fn is_a_diary_entry(&self) -> bool {
self.local().starts_with("diary")
}
} }