pub trait WorkflowModel<W: WorkflowDefinition> {
// Required methods
fn initial_states(&self) -> Vec<Option<W::State>>;
fn candidate_commands(&self, state: Option<&W::State>) -> Vec<W::Command>;
fn simulate(
&self,
state: Option<&W::State>,
command: &W::Command,
) -> SimulatedTransition<W::State, W::Event>;
// Provided method
fn declared_outcomes(&self) -> Vec<W::Outcome> { ... }
}Expand description
The transition model of a workflow, used for bounded exploration (spec §8.5).
A WorkflowDefinition says how state projects; a WorkflowModel says
how state moves. Keeping them apart means the explorer never has to run an
executor, a store or a clock.
Implementations must be deterministic and side-effect free: the explorer deduplicates states by their canonical JSON, so a model that mints a fresh identifier on every call turns a small workflow into an infinite one. Derive identifiers from the state instead (for example, the n-th line always gets the n-th identifier of a fixed table).
Required Methods§
Sourcefn initial_states(&self) -> Vec<Option<W::State>>
fn initial_states(&self) -> Vec<Option<W::State>>
The states exploration starts from. None means “the case does not
exist yet”, which is where most workflows begin — and it never means
“the case is over”, because a case’s identity outlives its content.
Provided Methods§
Sourcefn declared_outcomes(&self) -> Vec<W::Outcome>
fn declared_outcomes(&self) -> Vec<W::Outcome>
Outcomes the workflow claims it can reach. The explorer reports every declared outcome no reachable state projects. The default is empty, which disables the check.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".