Skip to main content

EventSourcedAggregate

Trait EventSourcedAggregate 

Source
pub trait EventSourcedAggregate: AggregateRoot {
    // Required methods
    fn from_events(
        id: String,
        events: impl IntoIterator<Item = Self::Event>,
    ) -> Self
       where Self: Sized;
    fn all_events(&self) -> Vec<Self::Event>;
}
Expand description

Extension trait for aggregates that support event sourcing.

Required Methods§

Source

fn from_events( id: String, events: impl IntoIterator<Item = Self::Event>, ) -> Self
where Self: Sized,

Reconstruct the aggregate from a stream of events.

Source

fn all_events(&self) -> Vec<Self::Event>

Get all events (including committed ones) for event sourcing.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§