add eq & partial_eq for RecursivePod, Pod traits and VDSet struct (for usage from introduction-pods) (#309)
* add eq & partial_eq for VDSet (for usage from introduction-pods) * add eq & partial_eq impls for Pod & RecursivePod traits
This commit is contained in:
parent
256d76ae34
commit
e1775d8578
10 changed files with 121 additions and 9 deletions
|
|
@ -805,7 +805,17 @@ pub trait Pod: fmt::Debug + DynClone + Any {
|
|||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any;
|
||||
fn equals(&self, other: &dyn Pod) -> bool;
|
||||
}
|
||||
impl PartialEq for Box<dyn Pod> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.equals(&**other)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Box<dyn Pod> {}
|
||||
|
||||
// impl Clone for Box<dyn Pod>
|
||||
dyn_clone::clone_trait_object!(Pod);
|
||||
|
|
@ -828,6 +838,13 @@ pub trait RecursivePod: Pod {
|
|||
where
|
||||
Self: Sized;
|
||||
}
|
||||
impl PartialEq for Box<dyn RecursivePod> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.equals(&**other)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Box<dyn RecursivePod> {}
|
||||
|
||||
// impl Clone for Box<dyn RecursivePod>
|
||||
dyn_clone::clone_trait_object!(RecursivePod);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue