Enum rustfsm_trait::TransitionResult[][src]

pub enum TransitionResult<Machine, DestinationState> where
    Machine: StateMachine,
    DestinationState: Into<Machine::State>, 
{ InvalidTransition, Ok { commands: Vec<Machine::Command>, new_state: DestinationState, shared_state: Machine::SharedState, }, OkNoShare { commands: Vec<Machine::Command>, new_state: DestinationState, }, Err(Machine::Error), }

A transition result is emitted every time the StateMachine handles an event.

Variants

InvalidTransition

This state does not define a transition for this event from this state. All other errors should use the Err variant.

Ok

The transition was successful

Fields of Ok

commands: Vec<Machine::Command>new_state: DestinationStateshared_state: Machine::SharedState
OkNoShare

The transition was successful with no shared state change

Fields of OkNoShare

commands: Vec<Machine::Command>new_state: DestinationState
Err(Machine::Error)

There was some error performing the transition

Implementations

impl<Sm, Ds> TransitionResult<Sm, Ds> where
    Sm: StateMachine,
    Ds: Into<Sm::State>, 
[src]

pub fn ok<CI>(commands: CI, new_state: Ds) -> Self where
    CI: IntoIterator<Item = Sm::Command>, 
[src]

Produce a transition with the provided commands to the provided state. No changes to shared state if it exists

pub fn ok_shared<CI, SS>(commands: CI, new_state: Ds, new_shared: SS) -> Self where
    CI: IntoIterator<Item = Sm::Command>,
    SS: Into<Sm::SharedState>, 
[src]

Produce a transition with the provided commands to the provided state with shared state changes

pub fn from<CurrentState>(current_state: CurrentState) -> Self where
    CurrentState: Into<Ds>, 
[src]

Uses Into to produce a transition with no commands from the provided current state to the provided (by type parameter) destination state.

impl<Sm, Ds> TransitionResult<Sm, Ds> where
    Sm: StateMachine,
    Ds: Into<Sm::State> + Default
[src]

pub fn commands<CI>(commands: CI) -> Self where
    CI: IntoIterator<Item = Sm::Command>, 
[src]

Produce a transition with commands relying on Default for the destination state’s value

pub fn default() -> Self[src]

Produce a transition with no commands relying on Default for the destination state’s value

impl<Sm, Ds> TransitionResult<Sm, Ds> where
    Sm: StateMachine,
    Ds: Into<Sm::State>, 
[src]

pub fn into_general(self) -> TransitionResult<Sm, Sm::State>[src]

Turns more-specific (struct) transition result into more-general (enum) transition result

Auto Trait Implementations

impl<Machine, DestinationState> RefUnwindSafe for TransitionResult<Machine, DestinationState> where
    DestinationState: RefUnwindSafe,
    <Machine as StateMachine>::Command: RefUnwindSafe,
    <Machine as StateMachine>::Error: RefUnwindSafe,
    <Machine as StateMachine>::SharedState: RefUnwindSafe

impl<Machine, DestinationState> Send for TransitionResult<Machine, DestinationState> where
    DestinationState: Send,
    <Machine as StateMachine>::Command: Send,
    <Machine as StateMachine>::Error: Send,
    <Machine as StateMachine>::SharedState: Send

impl<Machine, DestinationState> Sync for TransitionResult<Machine, DestinationState> where
    DestinationState: Sync,
    <Machine as StateMachine>::Command: Sync,
    <Machine as StateMachine>::Error: Sync,
    <Machine as StateMachine>::SharedState: Sync

impl<Machine, DestinationState> Unpin for TransitionResult<Machine, DestinationState> where
    DestinationState: Unpin,
    <Machine as StateMachine>::Command: Unpin,
    <Machine as StateMachine>::Error: Unpin,
    <Machine as StateMachine>::SharedState: Unpin

impl<Machine, DestinationState> UnwindSafe for TransitionResult<Machine, DestinationState> where
    DestinationState: UnwindSafe,
    <Machine as StateMachine>::Command: UnwindSafe,
    <Machine as StateMachine>::Error: UnwindSafe,
    <Machine as StateMachine>::SharedState: 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.