pub trait StateHandling {
// Required methods
fn state_type(&self) -> StateType;
fn as_any(&self) -> &dyn Any;
fn compare(&self, other: &dyn StateHandling) -> StateComparisonReport;
// Provided method
fn is_comparable(&self, other: &dyn StateHandling) -> bool { ... }
}Expand description
An interface to handle and compare the state of various types.
Required Methods§
Sourcefn state_type(&self) -> StateType
fn state_type(&self) -> StateType
Returns the StateType of the implementation.
Sourcefn compare(&self, other: &dyn StateHandling) -> StateComparisonReport
fn compare(&self, other: &dyn StateHandling) -> StateComparisonReport
Compares this and another StateHandling implementation.
§Notes
An implementation is expected to return
- an
Errorif the facilities of a backend cannot be used - a
StateComparisonReport::Incompatibleifselfandotherare not compatible (seeStateHandling::is_comparable)
Provided Methods§
Sourcefn is_comparable(&self, other: &dyn StateHandling) -> bool
fn is_comparable(&self, other: &dyn StateHandling) -> bool
Checks whether this StateHandling implementation is comparable to another.
Returns true, if the StateType of self and that of other can be compared, false
otherwise.
§Note
It should not be necessary to specifically implement this method.