[][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

type State: State

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

type Event: Event

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

Loading content...

Required methods

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

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

fn trigger(&self) -> Option<Self::Event>

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.

Loading content...

Implementors

Loading content...