Skip to main content

Reducer

Trait Reducer 

Source
pub trait Reducer<S: KernelState>: Send + Sync {
    // Required method
    fn apply(
        &self,
        state: &mut S,
        event: &SequencedEvent,
    ) -> Result<(), KernelError>;
}
Expand description

Reducer applies events to state. Must be pure (deterministic) for replay.

Required Methods§

Source

fn apply( &self, state: &mut S, event: &SequencedEvent, ) -> Result<(), KernelError>

Applies a single sequenced event to the state (in place).

Implementors§