Skip to main content

Aggregate

Trait Aggregate 

Source
pub trait Aggregate: Default {
    // Required method
    fn aggregate_type() -> &'static str;
}
Expand description

Trait for aggregate types.

Aggregates are the root entities in event sourcing. Each aggregate type has a unique identifier string used for event storage and routing.

This trait is typically derived using the #[evento::aggregate] macro.

§Example

#[evento::aggregate("myapp/Account")]
#[derive(Default)]
pub struct Account {
    pub balance: i64,
    pub owner: String,
}

Required Methods§

Source

fn aggregate_type() -> &'static str

Returns the unique type identifier for this aggregate (e.g., “myapp/Account”)

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§