pub trait Command<E>{
type Reply: Send + Sync + 'static;
type Error: Send + 'static;
// Required method
fn handle_command(
self,
id: &E::Id,
state: &E,
) -> CommandEffect<E, Self::Reply, Self::Error>;
}Expand description
A command for a EventSourced implementation, defining command handling and replying.
Required Associated Types§
Required Methods§
Sourcefn handle_command(
self,
id: &E::Id,
state: &E,
) -> CommandEffect<E, Self::Reply, Self::Error>
fn handle_command( self, id: &E::Id, state: &E, ) -> CommandEffect<E, Self::Reply, Self::Error>
The command handler, taking this command, and references to the ID and the state of
the event sourced entity, either rejecting this command via CommandEffect::reject or
returning an event using CommandEffect::emit_and_reply (or CommandEffect::emit in
case Reply = ()).