[][src]Trait sm::Machine

pub trait Machine: Debug + Eq {
    type State: State;
    type Event: Event;
    fn state(&self) -> Self::State;
fn trigger(&self) -> Option<Self::Event>; }

Machine provides the method required to query a state machine for its current state.

If you are using the sm! macro, then there is no need to interact with this trait.

Associated Types

State represents the current (static) state of the state machine.

Event represents the (optional) event that resulted in the current state of the machine.

Required Methods

state allows you to query the current state of the state machine.

trigger allows you to query the event that triggered the current state of the machine.

This returns an Option, which is None if the machine is in its initial state, caused by initialisation, not by an even-based transition.

Implementors