Skip to main content

CanTransitionMap

Trait CanTransitionMap 

Source
pub trait CanTransitionMap<Next: StateMarker> {
    type CurrentData;
    type Output;

    // Required method
    fn transition_map<F>(self, f: F) -> Self::Output
       where F: FnOnce(Self::CurrentData) -> Next::Data;
}
Expand description

A machine that can transition by mapping its current state data into Next.

This is the stable trait-level view of self.transition_map(...).

Required Associated Types§

Source

type CurrentData

The payload type stored in the current state.

Source

type Output

The transition result type.

Required Methods§

Source

fn transition_map<F>(self, f: F) -> Self::Output
where F: FnOnce(Self::CurrentData) -> Next::Data,

Perform the transition by consuming the current state data and producing the next payload.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§