Trait statig::StateMachine
source · pub trait StateMachinewhere
Self: Sized,{
type Event;
type State: State<Self>;
type Superstate<'a>: Superstate<Self>
where
Self::State: 'a;
const INIT_STATE: Self::State;
fn on_dispatch(
&mut self,
_state: StateOrSuperstate<'_, '_, Self>,
_event: &Self::Event
) { ... }
fn on_transition(&mut self, _source: &Self::State, _target: &Self::State) { ... }
}Expand description
A data structure that declares the types associated with the state machine.
Required Associated Types
sourcetype Superstate<'a>: Superstate<Self>
where
Self::State: 'a
type Superstate<'a>: Superstate<Self>
where
Self::State: 'a
Enumeration of the various superstates.
Required Associated Constants
sourceconst INIT_STATE: Self::State
const INIT_STATE: Self::State
Initial state of the state machine.
Provided Methods
sourcefn on_dispatch(
&mut self,
_state: StateOrSuperstate<'_, '_, Self>,
_event: &Self::Event
)
fn on_dispatch(
&mut self,
_state: StateOrSuperstate<'_, '_, Self>,
_event: &Self::Event
)
Method that is called before an event is dispatched to a state or superstate handler.
sourcefn on_transition(&mut self, _source: &Self::State, _target: &Self::State)
fn on_transition(&mut self, _source: &Self::State, _target: &Self::State)
Method that is called after every transition.