Struct game_state_machine::StateMachine[][src]

pub struct StateMachine<S> { /* fields omitted */ }

A state machine that holds the stack of states and performs transitions between states. It can be created using

StateMachine::<()>::default()

Generics

  • S: State data, the data that is sent to states for them to do their operations.

Implementations

impl<S> StateMachine<S>[src]

pub fn is_running(&self) -> bool[src]

Returns if the state machine still has states in its stack.

pub fn update(&mut self, state_data: &mut S)[src]

Updates the state at the top of the stack with the provided data. If the states returns a transition, perform it.

pub fn push(&mut self, state: Box<dyn State<S>>, state_data: &mut S)[src]

Push a state on the stack and start it. Pauses any previously active state.

pub fn stop(&mut self, state_data: &mut S)[src]

Removes all currently running states from the stack.

Trait Implementations

impl<S> Default for StateMachine<S>[src]

Auto Trait Implementations

impl<S> !RefUnwindSafe for StateMachine<S>

impl<S> !Send for StateMachine<S>

impl<S> !Sync for StateMachine<S>

impl<S> Unpin for StateMachine<S>

impl<S> !UnwindSafe for StateMachine<S>

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.