pub trait AppExtStates {
// Required methods
fn init_state<S>(&mut self) -> &mut Self
where S: FreelyMutableState + FromWorld;
fn insert_state<S>(&mut self, state: S) -> &mut Self
where S: FreelyMutableState;
fn add_computed_state<S>(&mut self) -> &mut Self
where S: ComputedStates;
fn add_sub_state<S>(&mut self) -> &mut Self
where S: SubStates;
fn register_type_state<S>(&mut self) -> &mut Self
where S: States + FromReflect + GetTypeRegistration + Typed;
fn register_type_mutable_state<S>(&mut self) -> &mut Self
where S: FreelyMutableState + FromReflect + GetTypeRegistration + Typed;
}Required Methods§
Sourcefn init_state<S>(&mut self) -> &mut Selfwhere
S: FreelyMutableState + FromWorld,
fn init_state<S>(&mut self) -> &mut Selfwhere
S: FreelyMutableState + FromWorld,
Initializes a State with standard starting values.
This method is idempotent: it has no effect when called again using the same generic type.
Adds State<S> and NextState<S> resources, and enables use of the OnEnter,
OnTransition and OnExit schedules.
These schedules are triggered before Update and at startup.
If you would like to control how other systems run based on the current state, you can
emulate this behavior using the in_state SystemCondition.
Note that you can also apply state transitions at other points in the schedule
by triggering the StateTransition schedule manually.
The use of any states requires the presence of StatesPlugin (which is included in DefaultPlugins).
Sourcefn insert_state<S>(&mut self, state: S) -> &mut Selfwhere
S: FreelyMutableState,
fn insert_state<S>(&mut self, state: S) -> &mut Selfwhere
S: FreelyMutableState,
Inserts a specific State to the current App and overrides any State previously
added of the same type.
Adds State<S> and NextState<S> resources, and enables use of the OnEnter,
OnTransition and OnExit schedules.
These schedules are triggered before Update and at startup.
If you would like to control how other systems run based on the current state, you can
emulate this behavior using the in_state SystemCondition.
Note that you can also apply state transitions at other points in the schedule
by triggering the StateTransition schedule manually.
Sourcefn add_computed_state<S>(&mut self) -> &mut Selfwhere
S: ComputedStates,
fn add_computed_state<S>(&mut self) -> &mut Selfwhere
S: ComputedStates,
Sets up a type implementing ComputedStates.
This method is idempotent: it has no effect when called again using the same generic type.
Sourcefn add_sub_state<S>(&mut self) -> &mut Selfwhere
S: SubStates,
fn add_sub_state<S>(&mut self) -> &mut Selfwhere
S: SubStates,
Sets up a type implementing SubStates.
This method is idempotent: it has no effect when called again using the same generic type.
Sourcefn register_type_state<S>(&mut self) -> &mut Self
fn register_type_state<S>(&mut self) -> &mut Self
Registers the state type T using App::register_type,
and adds ReflectState type data to T in the type registry.
This enables reflection code to access the state. For detailed information, see the docs on crate::reflect::ReflectState .
Sourcefn register_type_mutable_state<S>(&mut self) -> &mut Self
fn register_type_mutable_state<S>(&mut self) -> &mut Self
Registers the state type T using App::register_type,
and adds crate::reflect::ReflectState and crate::reflect::ReflectFreelyMutableState type data to T in the type registry.
This enables reflection code to access and modify the state.
For detailed information, see the docs on crate::reflect::ReflectState and crate::reflect::ReflectFreelyMutableState.
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.