Expand description
Equality between trait objects.
A trait with DynEq as a supertrait can have PartialEq and Eq
implemented for its objects by eq_trait_object!. Objects of two
different concrete types are never equal; two of the same type compare with
that type’s own Eq.
Import DynEq in the modules that call dyn_eq and nowhere else — do not
re-export it from a prelude. The blanket impl also covers Box<dyn Trait>,
whose dyn_eq downcasts to the box and so answers false for every
comparison. Method resolution reaches that impl only where the trait is in
scope, so a wide re-export silently turns boxed.dyn_eq(other) from a
comparison of the pointees into a constant false.
Macros§
- eq_
trait_ object - Implement
PartialEqandEqfor the objects of a trait havingDynEqas a supertrait, in all fourSend/Synccombinations.
Traits§
- DynEq
- Type-erased equality, blanket-implemented for every
Eq + 'statictype.