StateScopedEventsAppExt

Trait StateScopedEventsAppExt 

Source
pub trait StateScopedEventsAppExt {
    // Required method
    fn add_state_scoped_event<E>(
        &mut self,
        state: impl FreelyMutableState,
    ) -> &mut Self
       where E: Event;
}
Expand description

Extension trait for App adding methods for registering state scoped events.

Required Methods§

Source

fn add_state_scoped_event<E>( &mut self, state: impl FreelyMutableState, ) -> &mut Self
where E: Event,

Adds an Event that is automatically cleaned up when leaving the specified state.

Note that event cleanup is ordered ambiguously relative to StateScoped entity cleanup and the OnExit schedule for the target state. All of these (state scoped entities and events cleanup, and OnExit) occur within schedule StateTransition and system set StateTransitionSteps::ExitSchedules.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§