Skip to main content

TransitionMeta

Trait TransitionMeta 

Source
pub trait TransitionMeta<S>: Copy + Display {
    // Required methods
    fn target_state(&self) -> S;
    fn all() -> Vec<Self>;
    fn allowed_roles(&self) -> &'static [&'static str];
}
Expand description

Required trait for Transition enums — provides the metadata that StateMachineBehavior default methods need.

Implement this on each {Name}Transition enum:

ⓘ
impl TransitionMeta<AgentState> for AgentTransition {
    fn target_state(&self) -> AgentState { match self { ... } }
    fn all() -> Vec<Self> { vec![...] }
    fn allowed_roles(&self) -> &'static [&'static str] { match self { ... } }
}

Required Methods§

Source

fn target_state(&self) -> S

The state this transition leads to.

Source

fn all() -> Vec<Self>

All possible transitions (used by available_transitions).

Source

fn allowed_roles(&self) -> &'static [&'static str]

Roles allowed to fire this transition. Empty slice means unrestricted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§