pub trait Reducible {
    type Input;

    // Required methods
    fn init() -> Self;
    fn reduce(&mut self, input: Self::Input) -> bool;
Expand description

A trait that implements a reducer function.

For more information, see Reducer.

Required Associated Types§


type Input

The input message type used to modify the data.

Required Methods§


fn init() -> Self

Initialize the data.


fn reduce(&mut self, input: Self::Input) -> bool

Process the input message and update the state.

Return true to notify all subscribers. Return false to ignore all subscribers.

For example, it makes sense to return false to indicate that the message had no (noteworthy) effect on the data and the subscribers don’t need to be notified.