pub struct ActionState<A: Actionlike> { /* private fields */ }
Expand description
Stores the canonical input-method-agnostic representation of the inputs received
Can be used as either a resource or as a Component
on entities that you wish to control directly from player input.
§Disabling actions
Actions can be disabled in four different ways, with increasing granularity:
- By disabling updates to all actions using a run condition on
InputManagerSystem::Update
. - By disabling updates to all actions of type
A
using a run condition onTickActionStateSystem::<A>
. - By setting a specific action state to disabled using
ActionState::disable
. - By disabling a specific action using
ActionState::disable_action
.
More general mechanisms of disabling actions will cause specific mechanisms to be ignored. For example, if an entire action state is disabled, then enabling or disabling individual actions will have no effect.
Actions that are disabled will report as released (but not just released), and their values will be zero.
Under the hood, their values are still updated to avoid surprising behavior when re-enabled,
but they are not reported to the user using standard methods like ActionState::pressed
.
To check the underlying values, access their ActionData
directly.
§Example
use bevy::reflect::Reflect;
use leafwing_input_manager::prelude::*;
use bevy::platform::time::Instant;
#[derive(Actionlike, PartialEq, Eq, Hash, Clone, Copy, Debug, Reflect)]
enum Action {
Left,
Right,
Jump,
}
let mut action_state = ActionState::<Action>::default();
// Typically, this is done automatically by the `InputManagerPlugin` from user inputs
// using the `ActionState::update` method
action_state.press(&Action::Jump);
assert!(action_state.pressed(&Action::Jump));
assert!(action_state.just_pressed(&Action::Jump));
assert!(action_state.released(&Action::Left));
// Resets just_pressed and just_released
let t0 = Instant::now();
let t1 = Instant::now();
action_state.tick(t1, t0);
assert!(action_state.pressed(&Action::Jump));
assert!(!action_state.just_pressed(&Action::Jump));
action_state.release(&Action::Jump);
assert!(!action_state.pressed(&Action::Jump));
assert!(action_state.released(&Action::Jump));
assert!(action_state.just_released(&Action::Jump));
let t2 = Instant::now();
action_state.tick(t2, t1);
assert!(action_state.released(&Action::Jump));
assert!(!action_state.just_released(&Action::Jump));
Implementations§
Source§impl<A: Actionlike> ActionState<A>
impl<A: Actionlike> ActionState<A>
Sourcepub fn all_action_data(&self) -> &HashMap<A, ActionData>
pub fn all_action_data(&self) -> &HashMap<A, ActionData>
Returns a reference to the complete ActionData
for all actions.
Sourcepub fn update(&mut self, updated_actions: UpdatedActions<A>)
pub fn update(&mut self, updated_actions: UpdatedActions<A>)
Updates the ActionState
based on the provided UpdatedActions
.
The action_data
is typically constructed from InputMap::process_actions
,
which reads from the assorted ButtonInput
resources.
Actions that are disabled will still be updated: instead, their values will be read as released / zero.
You can see their underlying values by checking their ActionData
directly.
Sourcepub fn tick(&mut self, _current_instant: Instant, _previous_instant: Instant)
pub fn tick(&mut self, _current_instant: Instant, _previous_instant: Instant)
Advances the time for all actions,
transitioning them from just_pressed
to pressed
, and just_released
to released
.
If the timing
feature flag is enabled, the underlying timing and action data will be advanced according to the current_instant
.
- if no
Instant
is set, thecurrent_instant
will be set as the initial time at which the button was pressed / released - the
Duration
will advance to reflect elapsed time
§Example
use bevy::prelude::Reflect;
use leafwing_input_manager::prelude::*;
use leafwing_input_manager::buttonlike::ButtonState;
use bevy::platform::time::Instant;
#[derive(Actionlike, Clone, Copy, PartialEq, Eq, Hash, Debug, Reflect)]
enum Action {
Run,
Jump,
}
let mut action_state = ActionState::<Action>::default();
// Actions start released
assert!(action_state.released(&Action::Jump));
assert!(!action_state.just_released(&Action::Run));
// Ticking time moves causes buttons just released to no longer be just released
let t0 = Instant::now();
let t1 = Instant::now();
action_state.tick(t1, t0);
assert!(action_state.released(&Action::Jump));
assert!(!action_state.just_released(&Action::Jump));
action_state.press(&Action::Jump);
assert!(action_state.just_pressed(&Action::Jump));
// Ticking time moves causes buttons just pressed to no longer be just pressed
let t2 = Instant::now();
action_state.tick(t2, t1);
assert!(action_state.pressed(&Action::Jump));
assert!(!action_state.just_pressed(&Action::Jump));
Sourcepub fn action_data(&self, action: &A) -> Option<&ActionData>
pub fn action_data(&self, action: &A) -> Option<&ActionData>
A reference to the ActionData
corresponding to the action
.
Sourcepub fn action_data_mut(&mut self, action: &A) -> Option<&mut ActionData>
pub fn action_data_mut(&mut self, action: &A) -> Option<&mut ActionData>
A mutable reference to the ActionData
corresponding to the action
.
To initialize the ActionData
if it has not yet been triggered,
use action_data_mut_or_default
method.
Sourcepub fn action_data_mut_or_default(&mut self, action: &A) -> &mut ActionData
pub fn action_data_mut_or_default(&mut self, action: &A) -> &mut ActionData
A mutable reference to the ActionData
corresponding to the action
, initializing it if needed.
If the action
has no data yet (because the action
has not been triggered),
this method will create and insert a default ActionData
for you,
avoiding potential errors from unwrapping None
.
A reference of the ButtonData
corresponding to the action
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
§Caution
To access the ButtonData
regardless of whether the action
has been triggered,
use unwrap_or_default
on the returned Option
.
§Returns
Some(ButtonData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
A mutable reference of the ButtonData
corresponding to the action
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
§Caution
To access the ButtonData
regardless of whether the action
has been triggered,
use unwrap_or_default
on the returned Option
.
To insert a default ButtonData
if it doesn’t exist,
use button_data_mut_or_default
method.
§Returns
Some(ButtonData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
A mutable reference of the ButtonData
corresponding to the action
, initializing it if needed.
If the action
has no data yet (because the action
has not been triggered),
this method will create and insert a default ButtonData
for you,
avoiding potential errors from unwrapping None
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
Sourcepub fn axis_data_mut(&mut self, action: &A) -> Option<&mut AxisData>
pub fn axis_data_mut(&mut self, action: &A) -> Option<&mut AxisData>
A mutable reference of the AxisData
corresponding to the action
.
§Caution
To insert a default AxisData
if it doesn’t exist,
use axis_data_mut_or_default
method.
§Returns
Some(AxisData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
Sourcepub fn axis_data_mut_or_default(&mut self, action: &A) -> &mut AxisData
pub fn axis_data_mut_or_default(&mut self, action: &A) -> &mut AxisData
A mutable reference of the AxisData
corresponding to the action
, initializing it if needed..
If the action
has no data yet (because the action
has not been triggered),
this method will create and insert a default AxisData
for you,
avoiding potential errors from unwrapping None
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
Sourcepub fn dual_axis_data(&self, action: &A) -> Option<&DualAxisData>
pub fn dual_axis_data(&self, action: &A) -> Option<&DualAxisData>
A reference of the DualAxisData
corresponding to the action
.
§Caution
To access the DualAxisData
regardless of whether the action
has been triggered,
use unwrap_or_default
on the returned Option
.
§Returns
Some(DualAxisData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
Sourcepub fn dual_axis_data_mut(&mut self, action: &A) -> Option<&mut DualAxisData>
pub fn dual_axis_data_mut(&mut self, action: &A) -> Option<&mut DualAxisData>
A mutable reference of the DualAxisData
corresponding to the action
.
§Caution
To insert a default DualAxisData
if it doesn’t exist,
use dual_axis_data_mut_or_default
method.
§Returns
Some(DualAxisData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
Sourcepub fn dual_axis_data_mut_or_default(&mut self, action: &A) -> &mut DualAxisData
pub fn dual_axis_data_mut_or_default(&mut self, action: &A) -> &mut DualAxisData
A mutable reference of the DualAxisData
corresponding to the action
initializing it if needed.
If the action
has no data yet (because the action
has not been triggered),
this method will create and insert a default DualAxisData
for you,
avoiding potential errors from unwrapping None
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
Sourcepub fn triple_axis_data(&self, action: &A) -> Option<&TripleAxisData>
pub fn triple_axis_data(&self, action: &A) -> Option<&TripleAxisData>
A reference of the TripleAxisData
corresponding to the action
.
§Caution
To access the TripleAxisData
regardless of whether the action
has been triggered,
use unwrap_or_default
on the returned Option
.
§Returns
Some(TripleAxisData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
Sourcepub fn triple_axis_data_mut(
&mut self,
action: &A,
) -> Option<&mut TripleAxisData>
pub fn triple_axis_data_mut( &mut self, action: &A, ) -> Option<&mut TripleAxisData>
A mutable reference of the TripleAxisData
corresponding to the action
.
§Caution
To insert a default TripleAxisData
if it doesn’t exist,
use triple_axis_data_mut_or_default
method.
§Returns
Some(ButtonData)
if it exists.None
if theaction
has never been triggered (pressed, clicked, etc.).
Sourcepub fn triple_axis_data_mut_or_default(
&mut self,
action: &A,
) -> &mut TripleAxisData
pub fn triple_axis_data_mut_or_default( &mut self, action: &A, ) -> &mut TripleAxisData
A mutable reference of the TripleAxisData
corresponding to the action
initializing it if needed.
If the action
has no data yet (because the action
has not been triggered),
this method will create and insert a default TripleAxisData
for you,
avoiding potential errors from unwrapping None
.
Generally, it’ll be clearer to call pressed
or so on directly on the ActionState
.
However, accessing the raw data directly allows you to examine detailed metadata holistically.
Get the value associated with the corresponding buttonlike action
if present.
§Warnings
This value may not be bounded as you might expect.
Consider clamping this to account for multiple triggering inputs,
typically using the clamped_button_value
method instead.
Sets the value of the buttonlike action
to the provided value
.
Also updates the state of the button based on the value
:
- If
value > 0.0
, the button will be pressed. - If
value <= 0.0
, the button will be released.
Get the value associated with the corresponding action
, clamped to [0.0, 1.0]
.
§Warning
This value will be 0. by default, even if the action is not a buttonlike action.
Sourcepub fn value(&self, action: &A) -> f32
pub fn value(&self, action: &A) -> f32
Get the value associated with the corresponding axislike action
if present.
§Warnings
This value may not be bounded as you might expect.
Consider clamping this to account for multiple triggering inputs,
typically using the clamped_value
method instead.
Sourcepub fn set_value(&mut self, action: &A, value: f32)
pub fn set_value(&mut self, action: &A, value: f32)
Sets the value of the axislike action
to the provided value
.
Sourcepub fn clamped_value(&self, action: &A) -> f32
pub fn clamped_value(&self, action: &A) -> f32
Get the value associated with the corresponding action
, clamped to [-1.0, 1.0]
.
§Warning
This value will be 0. by default, even if the action is not an axislike action.
Sourcepub fn axis_pair(&self, action: &A) -> Vec2
pub fn axis_pair(&self, action: &A) -> Vec2
Get the Vec2
from the binding that triggered the corresponding action
.
Only events that represent dual-axis control provide a Vec2
,
and this will return None
for other events.
If multiple inputs with an axis pair trigger the same game action at the same time, the value of each axis pair will be added together.
§Warning
This value will be Vec2::ZERO
by default,
even if the action is not a dual-axislike action.
These values may not be bounded as you might expect.
Consider clamping this to account for multiple triggering inputs,
typically using the clamped_axis_pair
method instead.
Sourcepub fn set_axis_pair(&mut self, action: &A, pair: Vec2)
pub fn set_axis_pair(&mut self, action: &A, pair: Vec2)
Sets the Vec2
of the action
to the provided pair
.
Sourcepub fn clamped_axis_pair(&self, action: &A) -> Vec2
pub fn clamped_axis_pair(&self, action: &A) -> Vec2
Get the Vec2
associated with the corresponding action
, clamped to [-1.0, 1.0]
.
§Warning
This value will be Vec2::ZERO
by default,
even if the action is not a dual-axislike action.
Sourcepub fn axis_triple(&self, action: &A) -> Vec3
pub fn axis_triple(&self, action: &A) -> Vec3
Get the Vec3
from the binding that triggered the corresponding action
.
Only events that represent triple-axis control provide a Vec3
,
and this will return None
for other events.
If multiple inputs with an axis triple trigger the same game action at the same time, the value of each axis triple will be added together.
§Warning
This value will be Vec3::ZERO
by default,
even if the action is not a triple-axislike action.
These values may not be bounded as you might expect.
Consider clamping this to account for multiple triggering inputs,
typically using the clamped_axis_triple
method instead.
Sourcepub fn set_axis_triple(&mut self, action: &A, triple: Vec3)
pub fn set_axis_triple(&mut self, action: &A, triple: Vec3)
Sets the Vec2
of the action
to the provided pair
.
Sourcepub fn clamped_axis_triple(&self, action: &A) -> Vec3
pub fn clamped_axis_triple(&self, action: &A) -> Vec3
Get the Vec3
associated with the corresponding action
, clamped to the cube of values bounded by -1 and 1 on all axes.
§Warning
This value will be Vec3::ZERO
by default,
even if the action is not a dual-axislike action.
Manually sets the ButtonData
of the corresponding action
You should almost always use more direct methods, as they are simpler and less error-prone.
However, this method can be useful for testing,
or when transferring ButtonData
between action states.
§Example
use bevy::prelude::Reflect;
use leafwing_input_manager::prelude::*;
#[derive(Actionlike, Clone, Copy, PartialEq, Eq, Hash, Debug, Reflect)]
enum AbilitySlot {
Slot1,
Slot2,
}
#[derive(Actionlike, Clone, Copy, PartialEq, Eq, Hash, Debug, Reflect)]
enum Action {
Run,
Jump,
}
let mut ability_slot_state = ActionState::<AbilitySlot>::default();
let mut action_state = ActionState::<Action>::default();
// Extract the state from the ability slot
let slot_1_state = ability_slot_state.button_data(&AbilitySlot::Slot1);
// And transfer it to the actual ability that we care about
// without losing timing information
if let Some(state) = slot_1_state {
action_state.set_button_data(Action::Run, state.clone());
}
Sourcepub fn press(&mut self, action: &A)
pub fn press(&mut self, action: &A)
Press the action
No initial instant or reasons why the button was pressed will be recorded.
Instead, this is set through ActionState::tick()
Sourcepub fn release(&mut self, action: &A)
pub fn release(&mut self, action: &A)
Release the action
No initial instant will be recorded.
Instead, this is set through ActionState::tick()
Sourcepub fn reset(&mut self, action: &A)
pub fn reset(&mut self, action: &A)
Resets an action to its default state.
Buttons will be released, and axes will be set to 0.
Sourcepub fn reset_all(&mut self)
pub fn reset_all(&mut self)
Releases all Buttonlike
actions,
sets all Axislike
actions to 0,
sets all DualAxislike
actions to Vec2::ZERO
,
and sets all TripleAxislike
actions to Vec3::ZERO
.
Sourcepub fn disabled(&self) -> bool
pub fn disabled(&self) -> bool
Is the entire ActionState
currently disabled?
Sourcepub fn action_disabled(&self, action: &A) -> bool
pub fn action_disabled(&self, action: &A) -> bool
Is this action
currently disabled?
Sourcepub fn disable(&mut self)
pub fn disable(&mut self)
Disables the entire ActionState
.
All values will be reset to their default state.
Sourcepub fn disable_action(&mut self, action: &A)
pub fn disable_action(&mut self, action: &A)
Disables the action
.
The action’s value will be reset to its default state.
Sourcepub fn disable_all_actions(&mut self)
pub fn disable_all_actions(&mut self)
Disables all actions
Sourcepub fn enable(&mut self)
pub fn enable(&mut self)
Enables the entire ActionState
Sourcepub fn enable_action(&mut self, action: &A)
pub fn enable_action(&mut self, action: &A)
Enables the action
Sourcepub fn enable_all_actions(&mut self)
pub fn enable_all_actions(&mut self)
Enables all actions
Sourcepub fn pressed(&self, action: &A) -> bool
pub fn pressed(&self, action: &A) -> bool
Is this action
currently pressed?
§Warning
This value will be false
by default,
even if the action is not a buttonlike action.
Sourcepub fn just_pressed(&self, action: &A) -> bool
pub fn just_pressed(&self, action: &A) -> bool
Sourcepub fn just_released(&self, action: &A) -> bool
pub fn just_released(&self, action: &A) -> bool
Sourcepub fn get_pressed(&self) -> Vec<A>
pub fn get_pressed(&self) -> Vec<A>
Which actions are currently pressed?
Sourcepub fn get_just_pressed(&self) -> Vec<A>
pub fn get_just_pressed(&self) -> Vec<A>
Which actions were just pressed?
Sourcepub fn get_released(&self) -> Vec<A>
pub fn get_released(&self) -> Vec<A>
Which actions are currently released?
Sourcepub fn get_just_released(&self) -> Vec<A>
pub fn get_just_released(&self) -> Vec<A>
Which actions were just released?
Sourcepub fn instant_started(&self, action: &A) -> Option<Instant>
pub fn instant_started(&self, action: &A) -> Option<Instant>
The Instant
that the action was last pressed or released
If the action was pressed or released since the last time ActionState::tick
was called
the value will be None
.
This ensures that all our actions are assigned a timing and duration
that corresponds exactly to the start of a frame, rather than relying on idiosyncratic timing.
This will also be None
if the action was never pressed or released.
Sourcepub fn current_duration(&self, action: &A) -> Duration
pub fn current_duration(&self, action: &A) -> Duration
The Duration
for which the action has been held or released
This will be Duration::ZERO
if the action was never pressed or released.
Sourcepub fn previous_duration(&self, action: &A) -> Duration
pub fn previous_duration(&self, action: &A) -> Duration
The Duration
for which the action was last held or released
This is a snapshot of the ActionState::current_duration
state at the time
the action was last pressed or released.
This will be Duration::ZERO
if the action was never pressed or released.
Sourcepub fn apply_diff(&mut self, action_diff: &ActionDiff<A>)
pub fn apply_diff(&mut self, action_diff: &ActionDiff<A>)
Applies an ActionDiff
(usually received over the network) to the ActionState
.
This lets you reconstruct an ActionState
from a stream of ActionDiff
s
Sourcepub fn keys(&self) -> Vec<A>
pub fn keys(&self) -> Vec<A>
Returns an owned list of the Actionlike
keys in this ActionState
.
Trait Implementations§
Source§impl<A: Clone + Actionlike> Clone for ActionState<A>
impl<A: Clone + Actionlike> Clone for ActionState<A>
Source§fn clone(&self) -> ActionState<A>
fn clone(&self) -> ActionState<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<A: Actionlike> Component for ActionState<A>
impl<A: Actionlike> Component for ActionState<A>
Source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>
],
while immutable components will instead have [Component<Mutability = Immutable>
]. Read moreSource§fn register_required_components(
requiree: ComponentId,
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
inheritance_depth: u16,
recursion_check_stack: &mut Vec<ComponentId>,
)
fn register_required_components( requiree: ComponentId, components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, inheritance_depth: u16, recursion_check_stack: &mut Vec<ComponentId>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
Component::on_add
, etc.)ComponentHooks
.Source§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper
. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component
, this is populated by annotating fields containing entities with #[entities]
Read moreSource§impl<A: Debug + Actionlike> Debug for ActionState<A>
impl<A: Debug + Actionlike> Debug for ActionState<A>
Source§impl<A: Actionlike> Default for ActionState<A>
impl<A: Actionlike> Default for ActionState<A>
Source§impl<'de, A> Deserialize<'de> for ActionState<A>where
A: Deserialize<'de> + Actionlike,
impl<'de, A> Deserialize<'de> for ActionState<A>where
A: Deserialize<'de> + Actionlike,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<A> FromReflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> FromReflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self>
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self>
Self
from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self
using,
constructing the value using from_reflect
if that fails. Read moreSource§impl<A> GetTypeRegistration for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> GetTypeRegistration for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration
for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl<A: PartialEq + Actionlike> PartialEq for ActionState<A>
impl<A: PartialEq + Actionlike> PartialEq for ActionState<A>
Source§impl<A> PartialReflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> PartialReflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>
fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Self>) -> ReflectOwned
fn reflect_owned(self: Box<Self>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Self>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Self>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&dyn Reflect>
fn try_as_reflect(&self) -> Option<&dyn Reflect>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
Source§fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &dyn PartialReflect
fn as_partial_reflect(&self) -> &dyn PartialReflect
Source§fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect
Source§fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool>
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self
using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
reflect_clone
. To convert reflected values to dynamic ones, use to_dynamic
.Self
into its dynamic representation. Read moreSource§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl<A> Reflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Reflect for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
&mut dyn Any
. Read moreSource§fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &dyn Reflect
fn as_reflect(&self) -> &dyn Reflect
Source§fn as_reflect_mut(&mut self) -> &mut dyn Reflect
fn as_reflect_mut(&mut self) -> &mut dyn Reflect
Source§impl<A> Serialize for ActionState<A>where
A: Serialize + Actionlike,
impl<A> Serialize for ActionState<A>where
A: Serialize + Actionlike,
Source§impl<A> Struct for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Struct for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn field(&self, name: &str) -> Option<&dyn PartialReflect>
fn field(&self, name: &str) -> Option<&dyn PartialReflect>
name
as a &dyn PartialReflect
.Source§fn field_mut(&mut self, name: &str) -> Option<&mut dyn PartialReflect>
fn field_mut(&mut self, name: &str) -> Option<&mut dyn PartialReflect>
name
as a
&mut dyn PartialReflect
.Source§fn field_at(&self, index: usize) -> Option<&dyn PartialReflect>
fn field_at(&self, index: usize) -> Option<&dyn PartialReflect>
index
as a
&dyn PartialReflect
.Source§fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect>
fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect>
index
as a &mut dyn PartialReflect
.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index
.Source§fn iter_fields(&self) -> FieldIter<'_>
fn iter_fields(&self) -> FieldIter<'_>
fn to_dynamic_struct(&self) -> DynamicStruct
Source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
to_dynamic_struct
insteadDynamicStruct
.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None
if TypeInfo
is not available.Source§impl<A> TypePath for ActionState<A>
impl<A> TypePath for ActionState<A>
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl<A> Typed for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Typed for ActionState<A>where
ActionState<A>: Any + Send + Sync,
A: TypePath + Actionlike,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, ActionData>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A: Actionlike> Resource for ActionState<A>
impl<A: Actionlike> StructuralPartialEq for ActionState<A>
Auto Trait Implementations§
impl<A> Freeze for ActionState<A>
impl<A> RefUnwindSafe for ActionState<A>where
A: RefUnwindSafe,
impl<A> Send for ActionState<A>
impl<A> Sync for ActionState<A>
impl<A> Unpin for ActionState<A>where
A: Unpin,
impl<A> UnwindSafe for ActionState<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
Source§fn register_required_components(
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, )
Bundle
.Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info
.Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more