Skip to main content

Aggregate

Trait Aggregate 

Source
pub trait Aggregate:
    Default
    + Debug
    + Clone
    + Serialize
    + DeserializeOwned
    + MaybeSync
    + MaybeSend {
    type Event: Event;
    type Error: Error + MaybeSend + MaybeSync + 'static;

    const TYPE: &'static str;

    // Required methods
    fn aggregate_id(&self) -> String;
    fn with_aggregate_id(self, id: String) -> Self;
    fn apply(&mut self, event: Self::Event) -> Result<(), Self::Error>;
    fn error(status: StatusCode, details: &str) -> Self::Error;
}

Required Associated Constants§

Source

const TYPE: &'static str

Required Associated Types§

Required Methods§

Source

fn aggregate_id(&self) -> String

Source

fn with_aggregate_id(self, id: String) -> Self

Source

fn apply(&mut self, event: Self::Event) -> Result<(), Self::Error>

Source

fn error(status: StatusCode, details: &str) -> Self::Error

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§