Trait eventually_util::optional::Aggregate
source · [−]pub trait Aggregate {
type Id: Eq;
type State;
type Event;
type Command;
type Error;
fn apply_first(event: Self::Event) -> Result<Self::State, Self::Error>;
fn apply_next(
state: Self::State,
event: Self::Event
) -> Result<Self::State, Self::Error>;
fn handle_first<'s, 'a: 's>(
&'s self,
id: &'a Self::Id,
command: Self::Command
) -> BoxFuture<'s, Result<Option<Vec<Self::Event>>, Self::Error>>
where
Self: Sized;
fn handle_next<'a, 's: 'a>(
&'a self,
id: &'a Self::Id,
state: &'s Self::State,
command: Self::Command
) -> BoxFuture<'a, Result<Option<Vec<Self::Event>>, Self::Error>>
where
Self: Sized;
fn as_aggregate(self) -> AsAggregate<Self>
where
Self: Sized,
{ ... }
}Expand description
An Option-flavoured, Aggregate-compatible trait
to model Aggregates having an optional State.
Use as_aggregate to get an Aggregate-compatible instance
of this trait.
Associated Types
Identifier type of the Aggregate.
Check out Aggregate::Id for more information.
State of the Aggregate.
Check out Aggregate::State for more information.
Events produced and supported by the Aggregate.
Check out Aggregate::Event for more information.
Commands supported by the Aggregate.
Check out Aggregate::Command for more information.
Required methods
Provided methods
fn as_aggregate(self) -> AsAggregate<Self> where
Self: Sized,
fn as_aggregate(self) -> AsAggregate<Self> where
Self: Sized,
Translates the current optional::Aggregate instance into
a newtype instance compatible with the core Aggregate trait.