pub struct State<S> {
pub data: S,
/* private fields */
}
Expand description
Wrapper struct for a state S. Use in combination with StateTransition
.
Fields§
§data: S
Implementations§
Source§impl<S> State<S>
impl<S> State<S>
Sourcepub fn new(data: S) -> State<S>where
S: InitialState,
pub fn new(data: S) -> State<S>where
S: InitialState,
Construct the initial state of a state machine.
Sourcepub fn release_data(self) -> (Transition<S>, S)
pub fn release_data(self) -> (Transition<S>, S)
Releases the captured state data S
and provides a transition instance
to perform a compile time checked state transition.
Use this function when the state data S
is shared between multiple
states.
pub fn transition_to<T>(self, new_state: T) -> State<T>where
S: StateTransition<T>,
pub fn apply<T, E>(self, transition: T) -> Ewhere
T: MultiTransition<E, S>,
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for State<S>where
S: Freeze,
impl<S> RefUnwindSafe for State<S>where
S: RefUnwindSafe,
impl<S> Send for State<S>where
S: Send,
impl<S> Sync for State<S>where
S: Sync,
impl<S> Unpin for State<S>where
S: Unpin,
impl<S> UnwindSafe for State<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more