1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
pub mod r#static; use async_trait::async_trait; use crate::aggregate::Aggregate; pub type AggregateState<A: Aggregate> = A::State; pub type AggregateEvent<A: Aggregate> = A::Event; #[async_trait] pub trait Handler { type Command; type Aggregate: Aggregate; type Error; async fn handle( &self, state: &AggregateState<Self::Aggregate>, command: Self::Command, ) -> Result<Vec<AggregateEvent<Self::Aggregate>>, Self::Error>; }