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
or DualAxislike
.
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, KeyboardVirtualDPad::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: Gamepad,
)
pub fn handle_clashes( &self, updated_actions: &mut UpdatedActions<A>, input_store: &CentralInputStore, clash_strategy: ClashStrategy, gamepad: Gamepad, )
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: Gamepad) -> Self
pub fn with_gamepad(self, gamepad: Gamepad) -> Self
Assigns a particular Gamepad
to the entity 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: Gamepad) -> &mut Self
pub fn set_gamepad(&mut self, gamepad: Gamepad) -> &mut Self
Assigns a particular Gamepad
to the entity 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
associated with the entity 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: &Gamepads,
input_store: &CentralInputStore,
clash_strategy: ClashStrategy,
) -> UpdatedActions<A>
pub fn process_actions( &self, gamepads: &Gamepads, 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>
impl<A: Actionlike> Component for InputMap<A>
source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
source§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks
.source§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::utils::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
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
impl<A> FromReflect for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
source§fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
fn from_reflect(reflect: &dyn Reflect) -> Option<Self>
Self
from a reflected value.source§fn take_from_reflect(
reflect: Box<dyn Reflect>,
) -> Result<Self, Box<dyn Reflect>>
fn take_from_reflect( reflect: Box<dyn Reflect>, ) -> Result<Self, Box<dyn Reflect>>
Self
using,
constructing the value using from_reflect
if that fails. Read moresource§impl<A> GetTypeRegistration for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
impl<A> GetTypeRegistration for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + 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> Reflect for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
impl<A> Reflect for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
&mut dyn Any
.source§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§fn clone_value(&self) -> Box<dyn Reflect>
fn clone_value(&self) -> Box<dyn Reflect>
Reflect
trait object. Read moresource§fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
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 reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>
source§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
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 serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
source§impl<A> Struct for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
impl<A> Struct for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
source§fn field(&self, name: &str) -> Option<&dyn Reflect>
fn field(&self, name: &str) -> Option<&dyn Reflect>
name
as a &dyn Reflect
.source§fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>
fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>
name
as a
&mut dyn Reflect
.source§fn field_at(&self, index: usize) -> Option<&dyn Reflect>
fn field_at(&self, index: usize) -> Option<&dyn Reflect>
index
as a
&dyn Reflect
.source§fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>
fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>
index
as a &mut dyn Reflect
.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<'_>
source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct
.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
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + RegisterForReflection,
impl<A> Typed for InputMap<A>where
Self: Any + Send + Sync,
A: TypePath + Actionlike,
HashMap<A, Vec<Box<dyn Buttonlike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn Axislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn DualAxislike>>>: FromReflect + TypePath + RegisterForReflection,
HashMap<A, Vec<Box<dyn TripleAxislike>>>: FromReflect + TypePath + RegisterForReflection,
Option<Gamepad>: FromReflect + TypePath + 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 Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
. Box<dyn Any>
can
then be further downcast
into Box<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>
. Rc<Any>
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> DowncastSync for T
impl<T> DowncastSync 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<'_>))
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Self
using data from the given World
.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 Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read moresource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn Reflect + '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