Struct rust_fsm::StateMachine

source ·
pub struct StateMachine<T: StateMachineImpl> { /* private fields */ }
Expand description

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

Implementations§

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

Examples found in repository?
src/lib.rs (line 214)
213
214
215
    fn default() -> Self {
        Self::new()
    }

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

Examples found in repository?
src/lib.rs (line 178)
177
178
179
    pub fn new() -> Self {
        Self::from_state(T::INITIAL_STATE)
    }

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.

Returns the current state.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.