Trait StateCalc

Source
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§

Source

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>

Procedure which is called on StateCalc to accumulate an input state.

Source

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>

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

Detect whether the supplied state is enough to satisfy some target requirements.

Trait Implementations§

Source§

impl StateCalc for Box<dyn StateCalc>

Source§

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>

Procedure which is called on StateCalc to accumulate an input state.
Source§

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>

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

Detect whether the supplied state is enough to satisfy some target requirements.

Implementations on Foreign Types§

Source§

impl StateCalc for ()

Source§

impl StateCalc for Box<dyn StateCalc>

Implementors§