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§
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>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".