Struct rust_fsm::StateMachine[][src]

pub struct StateMachine<T: StateMachineImpl> { /* fields omitted */ }

A convenience wrapper around the StateMachine trait that encapsulates the state and transition and output function calls.

Implementations

impl<T> StateMachine<T> where
    T: StateMachineImpl
[src]

pub fn new() -> Self[src]

Create a new instance of this wrapper which encapsulates the initial state.

pub fn from_state(state: T::State) -> Self[src]

Create a new instance of this wrapper which encapsulates the given state.

pub fn consume(
    &mut self,
    input: &T::Input
) -> Result<Option<T::Output>, TransitionImpossibleError>
[src]

Consumes the provided input, gives an output and performs a state transition. If a state transition with the current state and the provided input is not allowed, returns an error.

pub fn state(&self) -> &T::State[src]

Returns the current state.

Trait Implementations

impl<T> Default for StateMachine<T> where
    T: StateMachineImpl
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for StateMachine<T> where
    <T as StateMachineImpl>::State: RefUnwindSafe

impl<T> Send for StateMachine<T> where
    <T as StateMachineImpl>::State: Send

impl<T> Sync for StateMachine<T> where
    <T as StateMachineImpl>::State: Sync

impl<T> Unpin for StateMachine<T> where
    <T as StateMachineImpl>::State: Unpin

impl<T> UnwindSafe for StateMachine<T> where
    <T as StateMachineImpl>::State: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.