Struct game_state_machine::StateMachine [−][src]
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]
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>,