Add map that provides a PartialEq implementation
Signed-off-by: trivernis <trivernis@protonmail.com>main
parent
29a76538dc
commit
06121f8234
@ -1,5 +1,7 @@
|
||||
mod clone_typemap;
|
||||
mod partialeq_typemap;
|
||||
mod typemap;
|
||||
|
||||
pub use clone_typemap::*;
|
||||
pub use partialeq_typemap::*;
|
||||
pub use typemap::*;
|
||||
|
@ -0,0 +1,18 @@
|
||||
use crate::impl_typemap;
|
||||
use multi_trait_object::{PartialEqAny, TryPartialEq};
|
||||
impl_typemap!(
|
||||
/// A typemap that provides a PartialEq implementation
|
||||
PartialEqTypeMap,
|
||||
PartialEqTypeMapKey,
|
||||
PartialEqAny
|
||||
);
|
||||
|
||||
impl PartialEq for PartialEqTypeMap {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0
|
||||
.0
|
||||
.iter()
|
||||
.zip(other.0 .0.iter())
|
||||
.all(|(a, b)| a.0 == b.0 && a.1.try_eq(b.1).unwrap())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue