1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
//! Support for synchronous and asynchronous state machines.

/// Denotes a type which represents a state machine.
pub trait StateMachine {
    /// The state type used by the state machine.
    type State: Ord;

    /// Gets the current state of the state machine.
    fn state(&self) -> Self::State;

    /// Transitions the state machine to a new state.
    fn transition(&self, state: Self::State);
}