Skip to main content

Projection

Trait Projection 

Source
pub trait Projection {
    type SourceId: Eq;
    type Event;
    type Error;

    // Required method
    fn project<'a>(
        &'a mut self,
        event: Persisted<Self::SourceId, Self::Event>,
    ) -> BoxFuture<'a, Result<(), Self::Error>>;
}
Expand description

A Projection is an optimized read model (or materialized view) of an Aggregate model(s), that can be assembled by left-folding its previous state and a number of ordered, consecutive events.

The events passed to a Projection have been persisted onto an EventStore first.

Required Associated Types§

Source

type SourceId: Eq

Type of the Source id, typically an AggregateId.

Source

type Event

Event to be stored in the EventStore, typically an Aggregate::Event.

Source

type Error

Type of the possible error that might occur when projecting the next state.

Required Methods§

Source

fn project<'a>( &'a mut self, event: Persisted<Self::SourceId, Self::Event>, ) -> BoxFuture<'a, Result<(), Self::Error>>

Updates the next value of the Projection using the provided event value.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§