Struct bevy_ecs::schedule::State[][src]

pub struct State<T: Component + Clone + Eq> { /* fields omitted */ }

Stack based state machine

This state machine has four operations: Push, Pop, Set and Replace.

  • Push pushes a new state to the state stack, pausing the previous state
  • Pop removes the current state, and unpauses the last paused state
  • Set replaces the active state with a new one
  • Replace unwinds the state stack, and replaces the entire stack with a single new state

Implementations

impl<T> State<T> where
    T: Component + Debug + Clone + Eq + Hash
[src]

pub fn on_update(s: T) -> RunCriteriaDescriptor[src]

pub fn on_inactive_update(s: T) -> RunCriteriaDescriptor[src]

pub fn on_in_stack_update(s: T) -> RunCriteriaDescriptor[src]

pub fn on_enter(s: T) -> RunCriteriaDescriptor[src]

pub fn on_exit(s: T) -> RunCriteriaDescriptor[src]

pub fn on_pause(s: T) -> RunCriteriaDescriptor[src]

pub fn on_resume(s: T) -> RunCriteriaDescriptor[src]

pub fn on_update_set(s: T) -> SystemSet[src]

pub fn on_inactive_update_set(s: T) -> SystemSet[src]

pub fn on_enter_set(s: T) -> SystemSet[src]

pub fn on_exit_set(s: T) -> SystemSet[src]

pub fn on_pause_set(s: T) -> SystemSet[src]

pub fn on_resume_set(s: T) -> SystemSet[src]

pub fn get_driver() -> SystemSet[src]

Creates a driver set for the State.

Important note: this set must be inserted before all other state-dependant sets to work properly!

pub fn new(initial: T) -> Self[src]

pub fn set(&mut self, state: T) -> Result<(), StateError>[src]

Schedule a state change that replaces the active state with the given state. This will fail if there is a scheduled operation, or if the given state matches the current state

pub fn overwrite_set(&mut self, state: T) -> Result<(), StateError>[src]

Same as Self::set, but if there is already a next state, it will be overwritten instead of failing

pub fn replace(&mut self, state: T) -> Result<(), StateError>[src]

Schedule a state change that replaces the full stack with the given state. This will fail if there is a scheduled operation, or if the given state matches the current state

pub fn overwrite_replace(&mut self, state: T) -> Result<(), StateError>[src]

Same as Self::replace, but if there is already a next state, it will be overwritten instead of failing

pub fn push(&mut self, state: T) -> Result<(), StateError>[src]

Same as Self::set, but does a push operation instead of a next operation

pub fn overwrite_push(&mut self, state: T) -> Result<(), StateError>[src]

Same as Self::push, but if there is already a next state, it will be overwritten instead of failing

pub fn pop(&mut self) -> Result<(), StateError>[src]

Same as Self::set, but does a pop operation instead of a set operation

pub fn overwrite_pop(&mut self) -> Result<(), StateError>[src]

Same as Self::pop, but if there is already a next state, it will be overwritten instead of failing

pub fn current(&self) -> &T[src]

pub fn inactives(&self) -> &[T][src]

Trait Implementations

impl<T: Debug + Component + Clone + Eq> Debug for State<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for State<T> where
    T: RefUnwindSafe

impl<T> Send for State<T>

impl<T> Sync for State<T>

impl<T> Unpin for State<T> where
    T: Unpin

impl<T> UnwindSafe for State<T> where
    T: UnwindSafe

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> Component for T where
    T: 'static + Send + Sync
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T> Instrument 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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,