Struct fsm::Machine [] [src]

pub struct Machine<S: EnumTag, E: EnumTag> {
    // some fields omitted
}

The Machine is the Finite State Machine, which has a current state and set of all valid transitions

Methods

impl<S: EnumTag, E: EnumTag> Machine<S, E>
[src]

fn new(initial_state: S) -> Machine<S, E>

Constructs a new FSM with a given initial state

fn add_transition(&mut self, in_state: S, on_event: E, next_state: S, action: Action<S, E>)

Registers a new valid transition with the FSM

fn current_state(&self) -> S

Retrieves a reference to the current state

fn on_event(&mut self, event_type: E)

Tick the State Machine with an Event