pub trait Aggregate {
type Id: Eq;
type State: Default;
type Event;
type Command;
type Error;
// Required methods
fn apply(
state: Self::State,
event: Self::Event,
) -> Result<Self::State, Self::Error>;
fn handle<'a, 's: 'a>(
&'a self,
id: &'s Self::Id,
state: &'s Self::State,
command: Self::Command,
) -> BoxFuture<'a, Result<Option<Vec<Self::Event>>, Self::Error>>
where Self: Sized;
}
Expand description
Required Associated Types§
Sourcetype Id: Eq
type Id: Eq
Aggregate identifier: this should represent an unique identifier to refer to a unique Aggregate instance.
Sourcetype State: Default
type State: Default
State of the Aggregate: this should represent the Domain Entity data structure.
Required Methods§
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.