Struct fsm::Machine [] [src]

pub struct Machine<S: Into<u32> + Clone, E: Into<u32> + Clone> {
    // some fields omitted
}

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

Methods

impl<S: Into<u32> + Clone, E: Into<u32> + Clone> 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<E>) -> bool

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

Trait Implementations

impl<S: Clone + Into<u32> + Clone, E: Clone + Into<u32> + Clone> Clone for Machine<S, E>
[src]

fn clone(&self) -> Machine<S, E>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more