pub trait StateCalc {
// Required methods
fn compare(&self, a: &StrictVal, b: &StrictVal) -> Option<Ordering>;
fn accumulate(&mut self, state: &StrictVal) -> Result<(), StateCalcError>;
fn lessen(&mut self, state: &StrictVal) -> Result<(), StateCalcError>;
fn diff(&self) -> Result<Vec<StrictVal>, StateCalcError>;
fn is_satisfied(&self, state: &StrictVal) -> bool;
}Required Methods§
Sourcefn compare(&self, a: &StrictVal, b: &StrictVal) -> Option<Ordering>
fn compare(&self, a: &StrictVal, b: &StrictVal) -> Option<Ordering>
Compares two state values (useful in sorting).
Sourcefn accumulate(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
fn accumulate(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
Procedure which is called on StateCalc to accumulate an input state.
Sourcefn lessen(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
fn lessen(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
Procedure which is called on StateCalc to lessen an output state.
Sourcefn diff(&self) -> Result<Vec<StrictVal>, StateCalcError>
fn diff(&self) -> Result<Vec<StrictVal>, StateCalcError>
Procedure which is called on StateCalc to compute the difference between an input
state and output state.
Sourcefn is_satisfied(&self, state: &StrictVal) -> bool
fn is_satisfied(&self, state: &StrictVal) -> bool
Detect whether the supplied state is enough to satisfy some target requirements.
Trait Implementations§
Source§impl StateCalc for Box<dyn StateCalc>
impl StateCalc for Box<dyn StateCalc>
Source§fn compare(&self, a: &StrictVal, b: &StrictVal) -> Option<Ordering>
fn compare(&self, a: &StrictVal, b: &StrictVal) -> Option<Ordering>
Compares two state values (useful in sorting).
Source§fn accumulate(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
fn accumulate(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
Procedure which is called on
StateCalc to accumulate an input state.Source§fn lessen(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
fn lessen(&mut self, state: &StrictVal) -> Result<(), StateCalcError>
Procedure which is called on
StateCalc to lessen an output state.Source§fn diff(&self) -> Result<Vec<StrictVal>, StateCalcError>
fn diff(&self) -> Result<Vec<StrictVal>, StateCalcError>
Procedure which is called on
StateCalc to compute the difference between an input
state and output state.Source§fn is_satisfied(&self, state: &StrictVal) -> bool
fn is_satisfied(&self, state: &StrictVal) -> bool
Detect whether the supplied state is enough to satisfy some target requirements.