pub struct InputMap<A: Actionlike> { /* private fields */ }
Expand description
A Multi-Map that allows you to map actions to multiple UserInputs
s,
whether they are Buttonlike
, Axislike
, DualAxislike
, or TripleAxislike
.
When inserting a binding, the InputControlKind
of the action variant must match that of the input type.
Use InputMap::insert
to insert buttonlike inputs,
InputMap::insert_axis
to insert axislike inputs,
and InputMap::insert_dual_axis
to insert dual-axislike inputs.
§Many-to-One Mapping
You can associate multiple Buttonlike
s (e.g., keyboard keys, mouse buttons, gamepad buttons)
with a single action, simplifying handling complex input combinations for the same action.
Duplicate associations are ignored.
§One-to-Many Mapping
A single Buttonlike
can be mapped to multiple actions simultaneously.
This allows flexibility in defining alternative ways to trigger an action.
§Clash Resolution
By default, the InputMap
prioritizes larger Buttonlike
combinations to trigger actions.
This means if two actions share some inputs, and one action requires all the inputs
of the other plus additional ones; only the larger combination will be registered.
This avoids unintended actions from being triggered by more specific input combinations.
For example, pressing both S
and Ctrl + S
in your text editor app
would only save your file (the larger combination), and not enter the letter s
.
This behavior can be customized using the ClashStrategy
resource.
§Examples
use bevy::prelude::*;
use leafwing_input_manager::prelude::*;
// Define your actions.
#[derive(Actionlike, Debug, Clone, Copy, PartialEq, Eq, Hash, Reflect)]
enum Action {
#[actionlike(DualAxis)]
Move,
Run,
Jump,
}
// Create an InputMap from an iterable,
// allowing for multiple input types per action.
let mut input_map = InputMap::new([
// Multiple inputs can be bound to the same action.
// Note that the type of your iterators must be homogeneous.
(Action::Run, KeyCode::ShiftLeft),
(Action::Run, KeyCode::ShiftRight),
// Note that duplicate associations are ignored.
(Action::Run, KeyCode::ShiftRight),
(Action::Jump, KeyCode::Space),
])
// Associate actions with other input types.
.with_dual_axis(Action::Move, VirtualDPad::wasd())
.with_dual_axis(Action::Move, GamepadStick::LEFT)
// Associate an action with multiple inputs at once.
.with_one_to_many(Action::Jump, [KeyCode::KeyJ, KeyCode::KeyU]);
// You can also use methods like a normal MultiMap.
input_map.insert(Action::Jump, KeyCode::KeyM);
// Remove all bindings to a specific action.
input_map.clear_action(&Action::Jump);
// Remove all bindings.
input_map.clear();
Implementations§
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn handle_clashes(
&self,
updated_actions: &mut UpdatedActions<A>,
input_store: &CentralInputStore,
clash_strategy: ClashStrategy,
gamepad: Entity,
)
pub fn handle_clashes( &self, updated_actions: &mut UpdatedActions<A>, input_store: &CentralInputStore, clash_strategy: ClashStrategy, gamepad: Entity, )
Resolve clashing button-like inputs, removing action presses that have been overruled
The usize
stored in pressed_actions
corresponds to Actionlike::index
Sourcepub fn decomposed(&self, action: &A) -> Vec<BasicInputs>
pub fn decomposed(&self, action: &A) -> Vec<BasicInputs>
Gets the decomposed BasicInputs
for each binding mapped to the given action.
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn new(bindings: impl IntoIterator<Item = (A, impl Buttonlike)>) -> Self
pub fn new(bindings: impl IntoIterator<Item = (A, impl Buttonlike)>) -> Self
Creates an InputMap
from an iterator over Buttonlike
action-input bindings.
Note that all elements within the iterator must be of the same type (homogeneous).
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with(self, action: A, button: impl Buttonlike) -> Self
pub fn with(self, action: A, button: impl Buttonlike) -> Self
Associates an action
with a specific Buttonlike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with_axis(self, action: A, axis: impl Axislike) -> Self
pub fn with_axis(self, action: A, axis: impl Axislike) -> Self
Associates an action
with a specific Axislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with_dual_axis(self, action: A, dual_axis: impl DualAxislike) -> Self
pub fn with_dual_axis(self, action: A, dual_axis: impl DualAxislike) -> Self
Associates an action
with a specific DualAxislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with_triple_axis(
self,
action: A,
triple_axis: impl TripleAxislike,
) -> Self
pub fn with_triple_axis( self, action: A, triple_axis: impl TripleAxislike, ) -> Self
Associates an action
with a specific TripleAxislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with_one_to_many(
self,
action: A,
inputs: impl IntoIterator<Item = impl Buttonlike>,
) -> Self
pub fn with_one_to_many( self, action: A, inputs: impl IntoIterator<Item = impl Buttonlike>, ) -> Self
Associates an action
with multiple Buttonlike
inputs
provided by an iterator.
Note that all elements within the iterator must be of the same type (homogeneous).
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn with_multiple(
self,
bindings: impl IntoIterator<Item = (A, impl Buttonlike)>,
) -> Self
pub fn with_multiple( self, bindings: impl IntoIterator<Item = (A, impl Buttonlike)>, ) -> Self
Adds multiple action-input bindings provided by an iterator. Note that all elements within the iterator must be of the same type (homogeneous).
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn insert(&mut self, action: A, button: impl Buttonlike) -> &mut Self
pub fn insert(&mut self, action: A, button: impl Buttonlike) -> &mut Self
Inserts a binding between an action
and a specific Buttonlike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn insert_axis(&mut self, action: A, axis: impl Axislike) -> &mut Self
pub fn insert_axis(&mut self, action: A, axis: impl Axislike) -> &mut Self
Inserts a binding between an action
and a specific Axislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn insert_dual_axis(
&mut self,
action: A,
dual_axis: impl DualAxislike,
) -> &mut Self
pub fn insert_dual_axis( &mut self, action: A, dual_axis: impl DualAxislike, ) -> &mut Self
Inserts a binding between an action
and a specific DualAxislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn insert_triple_axis(
&mut self,
action: A,
triple_axis: impl TripleAxislike,
) -> &mut Self
pub fn insert_triple_axis( &mut self, action: A, triple_axis: impl TripleAxislike, ) -> &mut Self
Inserts a binding between an action
and a specific TripleAxislike
input
.
Multiple inputs can be bound to the same action.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn insert_one_to_many(
&mut self,
action: A,
inputs: impl IntoIterator<Item = impl Buttonlike>,
) -> &mut Self
pub fn insert_one_to_many( &mut self, action: A, inputs: impl IntoIterator<Item = impl Buttonlike>, ) -> &mut Self
Inserts bindings between the same action
and multiple Buttonlike
inputs
provided by an iterator.
Note that all elements within the iterator must be of the same type (homogeneous).
To insert a chord, such as Control + A, use a ButtonlikeChord
.
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Sourcepub fn insert_multiple(
&mut self,
bindings: impl IntoIterator<Item = (A, impl Buttonlike)>,
) -> &mut Self
pub fn insert_multiple( &mut self, bindings: impl IntoIterator<Item = (A, impl Buttonlike)>, ) -> &mut Self
Inserts multiple action-input Buttonlike
bindings provided by an iterator.
Note that all elements within the iterator must be of the same type (homogeneous).
This method ensures idempotence, meaning that adding the same input for the same action multiple times will only result in a single binding being created.
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn with_gamepad(self, gamepad: Entity) -> Self
pub fn with_gamepad(self, gamepad: Entity) -> Self
Assigns a particular gamepad Entity
to the one controlled by this input map.
Use this when an InputMap
should exclusively accept input
from a particular gamepad.
If this is not called, input from any connected gamepad will be used. The first matching non-zero input will be accepted, as determined by gamepad registration order.
Because of this robust fallback behavior, this method can typically be ignored when writing single-player games.
Sourcepub fn set_gamepad(&mut self, gamepad: Entity) -> &mut Self
pub fn set_gamepad(&mut self, gamepad: Entity) -> &mut Self
Assigns a particular gamepad Entity
to the one controlled by this input map.
Use this when an InputMap
should exclusively accept input
from a particular gamepad.
If this is not called, input from any connected gamepad will be used. The first matching non-zero input will be accepted, as determined by gamepad registration order.
Because of this robust fallback behavior, this method can typically be ignored when writing single-player games.
Sourcepub fn clear_gamepad(&mut self) -> &mut Self
pub fn clear_gamepad(&mut self) -> &mut Self
Clears any gamepad Entity
associated with the one controlled by this input map.
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn pressed(
&self,
action: &A,
input_store: &CentralInputStore,
clash_strategy: ClashStrategy,
) -> bool
pub fn pressed( &self, action: &A, input_store: &CentralInputStore, clash_strategy: ClashStrategy, ) -> bool
Checks if the action
are currently pressed by any of the associated Buttonlike
s.
Accounts for clashing inputs according to the ClashStrategy
and remove conflicting actions.
Sourcepub fn process_actions(
&self,
gamepads: Option<Query<'_, '_, Entity, With<Gamepad>>>,
input_store: &CentralInputStore,
clash_strategy: ClashStrategy,
) -> UpdatedActions<A>
pub fn process_actions( &self, gamepads: Option<Query<'_, '_, Entity, With<Gamepad>>>, input_store: &CentralInputStore, clash_strategy: ClashStrategy, ) -> UpdatedActions<A>
Determines the correct state for each action according to provided CentralInputStore
.
This method uses the input bindings for each action to determine how to parse the input data,
and generates corresponding ButtonData
,
AxisData
and DualAxisData
.
For Buttonlike
actions, this accounts for clashing inputs according to the ClashStrategy
and removes conflicting actions.
Buttonlike
inputs will be pressed if any of the associated inputs are pressed.
Axislike
and DualAxislike
inputs will be the sum of all associated inputs.
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Returns an iterator over all registered Buttonlike
actions with their input bindings.
Sourcepub fn iter_axislike(
&self,
) -> impl Iterator<Item = (&A, &Vec<Box<dyn Axislike>>)>
pub fn iter_axislike( &self, ) -> impl Iterator<Item = (&A, &Vec<Box<dyn Axislike>>)>
Returns an iterator over all registered Axislike
actions with their input bindings.
Sourcepub fn iter_dual_axislike(
&self,
) -> impl Iterator<Item = (&A, &Vec<Box<dyn DualAxislike>>)>
pub fn iter_dual_axislike( &self, ) -> impl Iterator<Item = (&A, &Vec<Box<dyn DualAxislike>>)>
Returns an iterator over all registered DualAxislike
actions with their input bindings.
Sourcepub fn iter_triple_axislike(
&self,
) -> impl Iterator<Item = (&A, &Vec<Box<dyn TripleAxislike>>)>
pub fn iter_triple_axislike( &self, ) -> impl Iterator<Item = (&A, &Vec<Box<dyn TripleAxislike>>)>
Returns an iterator over all registered TripleAxislike
actions with their input bindings.
Returns an iterator over all registered Buttonlike
action-input bindings.
Sourcepub fn axislike_bindings(&self) -> impl Iterator<Item = (&A, &dyn Axislike)>
pub fn axislike_bindings(&self) -> impl Iterator<Item = (&A, &dyn Axislike)>
Returns an iterator over all registered Axislike
action-input bindings.
Sourcepub fn dual_axislike_bindings(
&self,
) -> impl Iterator<Item = (&A, &dyn DualAxislike)>
pub fn dual_axislike_bindings( &self, ) -> impl Iterator<Item = (&A, &dyn DualAxislike)>
Returns an iterator over all registered DualAxislike
action-input bindings.
Sourcepub fn triple_axislike_bindings(
&self,
) -> impl Iterator<Item = (&A, &dyn TripleAxislike)>
pub fn triple_axislike_bindings( &self, ) -> impl Iterator<Item = (&A, &dyn TripleAxislike)>
Returns an iterator over all registered TripleAxislike
action-input bindings.
Returns an iterator over all registered Buttonlike
actions.
Sourcepub fn axislike_actions(&self) -> impl Iterator<Item = &A>
pub fn axislike_actions(&self) -> impl Iterator<Item = &A>
Returns an iterator over all registered Axislike
actions.
Sourcepub fn dual_axislike_actions(&self) -> impl Iterator<Item = &A>
pub fn dual_axislike_actions(&self) -> impl Iterator<Item = &A>
Returns an iterator over all registered DualAxislike
actions.
Sourcepub fn triple_axislike_actions(&self) -> impl Iterator<Item = &A>
pub fn triple_axislike_actions(&self) -> impl Iterator<Item = &A>
Returns an iterator over all registered TripleAxislike
actions.
Sourcepub fn get(&self, action: &A) -> Option<Vec<UserInputWrapper>>
pub fn get(&self, action: &A) -> Option<Vec<UserInputWrapper>>
Returns a reference to the UserInput
inputs associated with the given action
.
§Warning
Unlike the other get
methods, this method is forced to clone the inputs
due to the lack of trait upcasting coercion.
As a result, no equivalent get_mut
method is provided.
Returns a reference to the Buttonlike
inputs associated with the given action
.
Returns a mutable reference to the Buttonlike
inputs mapped to action
Sourcepub fn get_axislike(&self, action: &A) -> Option<&Vec<Box<dyn Axislike>>>
pub fn get_axislike(&self, action: &A) -> Option<&Vec<Box<dyn Axislike>>>
Returns a reference to the Axislike
inputs associated with the given action
.
Sourcepub fn get_axislike_mut(
&mut self,
action: &A,
) -> Option<&mut Vec<Box<dyn Axislike>>>
pub fn get_axislike_mut( &mut self, action: &A, ) -> Option<&mut Vec<Box<dyn Axislike>>>
Returns a mutable reference to the Axislike
inputs mapped to action
Sourcepub fn get_dual_axislike(
&self,
action: &A,
) -> Option<&Vec<Box<dyn DualAxislike>>>
pub fn get_dual_axislike( &self, action: &A, ) -> Option<&Vec<Box<dyn DualAxislike>>>
Returns a reference to the DualAxislike
inputs associated with the given action
.
Sourcepub fn get_dual_axislike_mut(
&mut self,
action: &A,
) -> Option<&mut Vec<Box<dyn DualAxislike>>>
pub fn get_dual_axislike_mut( &mut self, action: &A, ) -> Option<&mut Vec<Box<dyn DualAxislike>>>
Returns a mutable reference to the DualAxislike
inputs mapped to action
Sourcepub fn get_triple_axislike(
&self,
action: &A,
) -> Option<&Vec<Box<dyn TripleAxislike>>>
pub fn get_triple_axislike( &self, action: &A, ) -> Option<&Vec<Box<dyn TripleAxislike>>>
Returns a reference to the TripleAxislike
inputs associated with the given action
.
Sourcepub fn get_triple_axislike_mut(
&mut self,
action: &A,
) -> Option<&mut Vec<Box<dyn TripleAxislike>>>
pub fn get_triple_axislike_mut( &mut self, action: &A, ) -> Option<&mut Vec<Box<dyn TripleAxislike>>>
Returns a mutable reference to the TripleAxislike
inputs mapped to action
Source§impl<A: Actionlike> InputMap<A>
impl<A: Actionlike> InputMap<A>
Sourcepub fn clear_action(&mut self, action: &A)
pub fn clear_action(&mut self, action: &A)
Clears all input bindings associated with the action
.
Sourcepub fn remove_at(&mut self, action: &A, index: usize) -> Option<()>
pub fn remove_at(&mut self, action: &A, index: usize) -> Option<()>
Removes the input for the action
at the provided index.
Returns Some(())
if the input was found and removed, or None
if no matching input was found.
§Note
The original input cannot be returned, as the trait object may differ based on the InputControlKind
.
Trait Implementations§
Source§impl<A: Actionlike> Component for InputMap<A>
Required Components: [ActionState :: < A >
].
impl<A: Actionlike> Component for InputMap<A>
Required Components: [ActionState :: < A >
].
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
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: Actionlike> Default for InputMap<A>
impl<A: Actionlike> Default for InputMap<A>
Source§impl<'de, A> Deserialize<'de> for InputMap<A>where
A: Deserialize<'de> + Actionlike,
impl<'de, A> Deserialize<'de> for InputMap<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: Actionlike, U: Buttonlike> From<HashMap<A, Vec<U>>> for InputMap<A>
impl<A: Actionlike, U: Buttonlike> From<HashMap<A, Vec<U>>> for InputMap<A>
Source§fn from(raw_map: HashMap<A, Vec<U>>) -> Self
fn from(raw_map: HashMap<A, Vec<U>>) -> Self
Converts a HashMap
mapping actions to multiple Buttonlike
s into an InputMap
.
§Examples
use bevy::prelude::*;
use bevy::platform::collections::HashMap;
use leafwing_input_manager::prelude::*;
#[derive(Actionlike, Debug, Clone, Copy, PartialEq, Eq, Hash, Reflect)]
enum Action {
Run,
Jump,
}
// Create an InputMap from a HashMap mapping actions to their key bindings.
let mut map: HashMap<Action, Vec<KeyCode>> = HashMap::default();
// Bind the "run" action to either the left or right shift keys to trigger the action.
map.insert(
Action::Run,
vec![KeyCode::ShiftLeft, KeyCode::ShiftRight],
);
let input_map = InputMap::from(map);
Source§impl<A: Actionlike, U: Buttonlike> FromIterator<(A, U)> for InputMap<A>
impl<A: Actionlike, U: Buttonlike> FromIterator<(A, U)> for InputMap<A>
Source§impl<A> FromReflect for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> FromReflect for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: 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 InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> GetTypeRegistration for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: 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> PartialReflect for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> PartialReflect for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: 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 InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Reflect for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: 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> Struct for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Struct for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: 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 InputMap<A>
impl<A> TypePath for InputMap<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 InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl<A> Typed for InputMap<A>where
InputMap<A>: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Entity>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl<A: Actionlike> VisitAssetDependencies for InputMap<A>
impl<A: Actionlike> VisitAssetDependencies for InputMap<A>
fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))
impl<A: Actionlike> Asset for InputMap<A>
impl<A: Eq + Actionlike> Eq for InputMap<A>
impl<A: Actionlike> Resource for InputMap<A>
impl<A: Actionlike> StructuralPartialEq for InputMap<A>
Auto Trait Implementations§
impl<A> Freeze for InputMap<A>
impl<A> !RefUnwindSafe for InputMap<A>
impl<A> Send for InputMap<A>
impl<A> Sync for InputMap<A>
impl<A> Unpin for InputMap<A>where
A: Unpin,
impl<A> !UnwindSafe for InputMap<A>
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<A> AssetContainer for Awhere
A: Asset,
impl<A> AssetContainer for Awhere
A: Asset,
fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)
fn asset_type_name(&self) -> &'static str
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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