StateMachine

Trait StateMachine 

Source
pub trait StateMachine {
    type State;

    // Required methods
    fn state(&self) -> Self::State;
    fn transition(&self, state: Self::State) -> Context;
}
Expand description

Denotes a type which represents a state machine.

Required Associated Types§

Source

type State

The state type used by the state machine.

Required Methods§

Source

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

Gets the current state of the state machine.

Source

fn transition(&self, state: Self::State) -> Context

Transitions the state machine to a new state.

Returns the context in which the new state is running.

Implementors§