Struct fsm::Machine
[−]
[src]
pub struct Machine<'a, S: EnumTag, E: EnumTag> { /* fields omitted */ }
The Machine is the Finite State Machine, which has a current state and set of all valid transitions
Methods
impl<'a, S: EnumTag, E: EnumTag> Machine<'a, S, E>
[src]
fn new(initial_state: S) -> Machine<'a, S, E>
Constructs a new FSM with a given initial state
fn add_transition<F>(
&mut self,
in_state: S,
on_event: E,
next_state: S,
action: F
) -> bool where
F: Fn(&S, &E) + 'a,
&mut self,
in_state: S,
on_event: E,
next_state: S,
action: F
) -> bool where
F: Fn(&S, &E) + 'a,
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