Trait comparable::Comparable
source · [−]pub trait Comparable {
type Desc: PartialEq + Debug;
type Change: PartialEq + Debug;
fn describe(&self) -> Self::Desc;
fn comparison(&self, other: &Self) -> Changed<Self::Change>ⓘNotable traits for Changed<T>impl<T> Iterator for Changed<T> type Item = T;
;
}
Required Associated Types
sourcetype Desc: PartialEq + Debug
type Desc: PartialEq + Debug
Describes the type under consideration. For types that use
#[derive(Comparable)]
this is a mirror of the type itself, where all
field types refer to the Comparable::Desc
associated type of the
original type.
sourcetype Change: PartialEq + Debug
type Change: PartialEq + Debug
Reflects all changes between two values of a type. The exact nature of this type depends on the type being compared, for example, singleton struts vary from structs with multiple fields. Please see the full documentation for more details.
Required Methods
sourcefn comparison(&self, other: &Self) -> Changed<Self::Change>ⓘNotable traits for Changed<T>impl<T> Iterator for Changed<T> type Item = T;
fn comparison(&self, other: &Self) -> Changed<Self::Change>ⓘNotable traits for Changed<T>impl<T> Iterator for Changed<T> type Item = T;
Compare two values of a type, reporting whether they differ and what
the complete set of differences looks like. This is used by the
comparable::assert_changes
function so that tests can ensure that
what was expected to happen did happen – and nothing more.