StateScopedMessagesAppExt

Trait StateScopedMessagesAppExt 

Source
pub trait StateScopedMessagesAppExt {
    // Required methods
    fn clear_messages_on_exit<M>(&mut self, state: impl States) -> &mut Self
       where M: Message;
    fn clear_messages_on_enter<M>(&mut self, state: impl States) -> &mut Self
       where M: Message;
}
Expand description

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

Required Methods§

Source

fn clear_messages_on_exit<M>(&mut self, state: impl States) -> &mut Self
where M: Message,

Clears a Message when exiting the specified state.

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

Source

fn clear_messages_on_enter<M>(&mut self, state: impl States) -> &mut Self
where M: Message,

Clears a Message when entering the specified state.

Note that message cleanup is ambiguously ordered relative to DespawnOnEnter entity cleanup, and the OnEnter schedule for the target state. All of these (state scoped entities and messages cleanup, and OnEnter) occur within schedule StateTransition and system set StateTransitionSystems::EnterSchedules.

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§