Trait eventsourced::EventSourced
source · pub trait EventSourced {
type Id: Debug + Send + 'static;
type Cmd: Debug + Send + Sync + 'static;
type Evt: Debug + Send + Sync;
type State: Debug + Default + Send + Sync + 'static;
type Error: StdError + Send + Sync + 'static;
const TYPE_NAME: &'static str;
// Required methods
fn handle_cmd(
id: &Self::Id,
state: &Self::State,
cmd: Self::Cmd
) -> Result<Self::Evt, Self::Error>;
fn handle_evt(state: Self::State, evt: Self::Evt) -> Self::State;
}Expand description
Command and event handling for an event sourced entity.
Required Associated Types§
Required Associated Constants§
Required Methods§
sourcefn handle_cmd(
id: &Self::Id,
state: &Self::State,
cmd: Self::Cmd
) -> Result<Self::Evt, Self::Error>
fn handle_cmd( id: &Self::Id, state: &Self::State, cmd: Self::Cmd ) -> Result<Self::Evt, Self::Error>
Command handler, returning the to be persisted event or an error.
sourcefn handle_evt(state: Self::State, evt: Self::Evt) -> Self::State
fn handle_evt(state: Self::State, evt: Self::Evt) -> Self::State
Event handler.
Object Safety§
This trait is not object safe.