Cleaner comparisons
This commit is contained in:
parent
751a98d281
commit
f760176435
5 changed files with 46 additions and 11 deletions
10
src/item.rs
10
src/item.rs
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue