Skip to main content

FiniteStateMachine

Trait FiniteStateMachine 

Source
pub trait FiniteStateMachine {
    type State: Clone + Eq + 'static;
    type Data: Clone + 'static;
    type Msg: Send + 'static;

    // Required methods
    fn initial_state(&self) -> Self::State;
    fn initial_data(&self) -> Self::Data;
    fn transition(
        &mut self,
        current: &Self::State,
        data: &Self::Data,
        msg: Self::Msg,
    ) -> Option<FsmTransition<Self::State, Self::Data>>;
}
Expand description

Simple trait-based FSM. Actors implementing this trait are driven by ctx.become(...) inside their cell.

Required Associated Types§

Source

type State: Clone + Eq + 'static

Source

type Data: Clone + 'static

Source

type Msg: Send + 'static

Required Methods§

Source

fn initial_state(&self) -> Self::State

Source

fn initial_data(&self) -> Self::Data

Source

fn transition( &mut self, current: &Self::State, data: &Self::Data, msg: Self::Msg, ) -> Option<FsmTransition<Self::State, Self::Data>>

Implementors§