Require that PartialEq
is implemented for Action
This commit is contained in:
parent
eae7c2267c
commit
3a69943df3
19 changed files with 58 additions and 49 deletions
|
@ -5,6 +5,7 @@ pub trait Action: 'static {
|
|||
fn name(&self) -> &'static str;
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
fn boxed_clone(&self) -> Box<dyn Action>;
|
||||
fn eq(&self, other: &dyn Action) -> bool;
|
||||
|
||||
fn qualified_name() -> &'static str
|
||||
where
|
||||
|
@ -103,6 +104,14 @@ macro_rules! __impl_action {
|
|||
Box::new(self.clone())
|
||||
}
|
||||
|
||||
fn eq(&self, other: &dyn $crate::Action) -> bool {
|
||||
if let Some(other) = other.as_any().downcast_ref::<Self>() {
|
||||
self == other
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
$from_json_fn
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue