Trait eventsourced::Cmd

source ·
pub trait Cmd<E>
where Self: Debug + Send + 'static, E: EventSourced,
{ type Reply: Send + 'static; type Error: Send + 'static; // Required method fn handle_cmd( self, id: &E::Id, state: &E ) -> CmdEffect<E, Self::Reply, Self::Error>; }
Expand description

A command for a EventSourced implementation, defining command handling and replying.

Required Associated Types§

source

type Reply: Send + 'static

The type for replies.

source

type Error: Send + 'static

The type for rejecting this command.

Required Methods§

source

fn handle_cmd( self, id: &E::Id, state: &E ) -> CmdEffect<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 CmdEffect::reject or returning an event using CmdEffect::emit_and_reply (or CmdEffect::emit in case Reply = ()).

Implementors§