Skip to main content

Projection

Trait Projection 

Source
pub trait Projection {
    type State;
    type Event;

    // Required methods
    fn initial() -> Self::State;
    fn apply(state: Self::State, event: &Self::Event) -> Self::State;
}
Expand description

Fold an ordered event stream into aggregate state.

Required Associated Types§

Source

type State

Rebuilt aggregate state.

Source

type Event

Domain event type consumed by this projection.

Required Methods§

Source

fn initial() -> Self::State

State before any events are applied.

Source

fn apply(state: Self::State, event: &Self::Event) -> Self::State

Apply a single event to state, returning the new state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§