Cleaner comparisons

This commit is contained in:
daladim 2021-04-03 17:42:55 +02:00
parent 751a98d281
commit f760176435
5 changed files with 46 additions and 11 deletions

View file

@ -10,7 +10,7 @@ use crate::resource::Resource;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Item {
Event(crate::event::Event),
Task(crate::task::Task),
@ -79,6 +79,14 @@ impl Item {
_ => panic!("Not a task"),
}
}
pub fn has_same_observable_content(&self, other: &Item) -> bool {
match (self, other) {
(Item::Event(s), Item::Event(o)) => s.has_same_observable_content(o),
(Item::Task(s), Item::Task(o)) => s.has_same_observable_content(o),
_ => false,
}
}
}