Skip to main content

Aggregator

Trait Aggregator 

Source
pub trait Aggregator: Default {
    // Required method
    fn aggregator_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::aggregator] macro.

§Example

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

Required Methods§

Source

fn aggregator_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", so this trait is not object safe.

Implementors§