Struct rust_fsm::StateMachine [−][src]
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]
T: StateMachineImpl,
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]
&mut self,
input: &T::Input
) -> Result<Option<T::Output>, TransitionImpossibleError>
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]
T: StateMachineImpl,
Auto Trait Implementations
impl<T> RefUnwindSafe for StateMachine<T> where
<T as StateMachineImpl>::State: RefUnwindSafe,
<T as StateMachineImpl>::State: RefUnwindSafe,
impl<T> Send for StateMachine<T> where
<T as StateMachineImpl>::State: Send,
<T as StateMachineImpl>::State: Send,
impl<T> Sync for StateMachine<T> where
<T as StateMachineImpl>::State: Sync,
<T as StateMachineImpl>::State: Sync,
impl<T> Unpin for StateMachine<T> where
<T as StateMachineImpl>::State: Unpin,
<T as StateMachineImpl>::State: Unpin,
impl<T> UnwindSafe for StateMachine<T> where
<T as StateMachineImpl>::State: UnwindSafe,
<T as StateMachineImpl>::State: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,