State

Trait State 

Source
pub trait State<D> {
    // Provided methods
    fn on_start(&mut self, _data: &mut D) { ... }
    fn on_stop(&mut self, _data: &mut D) { ... }
    fn on_pause(&mut self, _data: &mut D) { ... }
    fn on_resume(&mut self, _data: &mut D) { ... }
    fn on_tick(&mut self, _data: &mut D) -> Trans<D> { ... }
    fn on_shadow_tick(&mut self, _data: &mut D) -> Trans<D> { ... }
}
Expand description

Describes an application state.

See the crates docs or the book for more information.

§Generics

  • D: Data available to all States to perform actions to.

Provided Methods§

Source

fn on_start(&mut self, _data: &mut D)

Called when this State first enters the stack.

Source

fn on_stop(&mut self, _data: &mut D)

Called when this State is popped from the stack.

Source

fn on_pause(&mut self, _data: &mut D)

Called when this State loses its topmost position in the stack to another State that has been pushed ontop of it.

Source

fn on_resume(&mut self, _data: &mut D)

Called when this State regains the first position in the stack. Id est, when other States above it are popped.

Source

fn on_tick(&mut self, _data: &mut D) -> Trans<D>

Represents a single tick/update. It’s called when the Stack’s .tick() is called. Your loop logic should call your stack’s tick, not this directly.

Source

fn on_shadow_tick(&mut self, _data: &mut D) -> Trans<D>

Represents a single tick/update independent of this State position in the stack. It’s called when the Stack’s .tick() is called. NOTE: on_shadow_tick is called BEFORE on_tick.

Implementors§