pub struct StateMachine { /* private fields */ }
Expand description
A simple stack-based state machine (pushdown automaton).
Implementations§
Source§impl StateMachine
impl StateMachine
pub fn new<T>(initial_state: T) -> StateMachinewhere
T: State + 'static,
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Checks whether the state machine is running.
Sourcepub fn handle_events(&mut self, events: &[i32])
pub fn handle_events(&mut self, events: &[i32])
Passes a vector of events to the active state to handle.
Sourcepub fn fixed_update(&mut self, delta_time: Duration)
pub fn fixed_update(&mut self, delta_time: Duration)
Updates the currently active state at a steady, fixed interval.
Auto Trait Implementations§
impl Freeze for StateMachine
impl !RefUnwindSafe for StateMachine
impl !Send for StateMachine
impl !Sync for StateMachine
impl Unpin for StateMachine
impl !UnwindSafe for StateMachine
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