Trait Accumulator

Source
pub trait Accumulator {
    type State;
    type Update;

    // Required methods
    fn accumulate(
        &self,
        state: &mut Self::State,
        update: Self::Update,
    ) -> Result<()>;
    fn reducer_spec(&self) -> Option<ReducerSpec>;
}
Expand description

An accumulator is a object that accumulates updates into a state.

Required Associated Types§

Source

type State

The type of the accumulated state.

Source

type Update

The type of the updates sent to the accumulator. Updates will be accumulated into type Self::State.

Required Methods§

Source

fn accumulate( &self, state: &mut Self::State, update: Self::Update, ) -> Result<()>

Accumulate an update into the current state.

Source

fn reducer_spec(&self) -> Option<ReducerSpec>

The specification used to build the reducer.

Implementors§