pub trait PureWorkflow: WorkflowDefinition {
// Required methods
fn apply(
&self,
state: Option<&Self::State>,
command: &Self::Command,
) -> Result<Applied<Self::State, Self::Event>, DomainRejection>;
fn event_type(&self, event: &Self::Event) -> String;
}Expand description
A workflow whose transitions are one pure function.
Splitting this out of WorkflowDefinition keeps the definition free of
execution concerns while letting the kit derive both an executor and an
exploration model from a single description of what a command does.
Required Methods§
Sourcefn apply(
&self,
state: Option<&Self::State>,
command: &Self::Command,
) -> Result<Applied<Self::State, Self::Event>, DomainRejection>
fn apply( &self, state: Option<&Self::State>, command: &Self::Command, ) -> Result<Applied<Self::State, Self::Event>, DomainRejection>
Applies one command to one state, refusing it the way the real domain
would. Must be deterministic and must not mutate state.
Sourcefn event_type(&self, event: &Self::Event) -> String
fn event_type(&self, event: &Self::Event) -> String
Stable event type label of an event, e.g. "trip.extra_added".
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".