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§
Sourcetype Update
type Update
The type of the updates sent to the accumulator. Updates will be accumulated into type Self::State.
Required Methods§
Sourcefn accumulate(
&self,
state: &mut Self::State,
update: Self::Update,
) -> Result<()>
fn accumulate( &self, state: &mut Self::State, update: Self::Update, ) -> Result<()>
Accumulate an update into the current state.
Sourcefn reducer_spec(&self) -> Option<ReducerSpec>
fn reducer_spec(&self) -> Option<ReducerSpec>
The specification used to build the reducer.