leafwing_input_manager::input_map

Struct InputMap

source
pub struct InputMap<A: Actionlike> { /* private fields */ }
Expand description

A Multi-Map that allows you to map actions to multiple UserInputss, 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 Buttonlikes (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>

source

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

source

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>

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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>

source

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.

source

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.

source

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.

source

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.

source

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.

source

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

pub fn merge(&mut self, other: &InputMap<A>) -> &mut Self

Merges the provided InputMap into this map, combining their bindings, avoiding duplicates.

If the associated gamepads do not match, the association will be removed.

source§

impl<A: Actionlike> InputMap<A>

source

pub const fn gamepad(&self) -> Option<Gamepad>

Fetches the Gamepad associated with the entity controlled by this input map.

If this is None, input from any connected gamepad will be used.

source

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.

source

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.

source

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>

source

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 Buttonlikes.

Accounts for clashing inputs according to the ClashStrategy and remove conflicting actions.

source

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>

source

pub fn iter_buttonlike( &self, ) -> impl Iterator<Item = (&A, &Vec<Box<dyn Buttonlike>>)>

Returns an iterator over all registered Buttonlike actions with their input bindings.

source

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.

source

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.

source

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.

source

pub fn buttonlike_bindings(&self) -> impl Iterator<Item = (&A, &dyn Buttonlike)>

Returns an iterator over all registered Buttonlike action-input bindings.

source

pub fn axislike_bindings(&self) -> impl Iterator<Item = (&A, &dyn Axislike)>

Returns an iterator over all registered Axislike action-input bindings.

source

pub fn dual_axislike_bindings( &self, ) -> impl Iterator<Item = (&A, &dyn DualAxislike)>

Returns an iterator over all registered DualAxislike action-input bindings.

source

pub fn triple_axislike_bindings( &self, ) -> impl Iterator<Item = (&A, &dyn TripleAxislike)>

Returns an iterator over all registered TripleAxislike action-input bindings.

source

pub fn buttonlike_actions(&self) -> impl Iterator<Item = &A>

Returns an iterator over all registered Buttonlike actions.

source

pub fn axislike_actions(&self) -> impl Iterator<Item = &A>

Returns an iterator over all registered Axislike actions.

source

pub fn dual_axislike_actions(&self) -> impl Iterator<Item = &A>

Returns an iterator over all registered DualAxislike actions.

source

pub fn triple_axislike_actions(&self) -> impl Iterator<Item = &A>

Returns an iterator over all registered TripleAxislike actions.

source

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.

source

pub fn get_buttonlike(&self, action: &A) -> Option<&Vec<Box<dyn Buttonlike>>>

Returns a reference to the Buttonlike inputs associated with the given action.

source

pub fn get_buttonlike_mut( &mut self, action: &A, ) -> Option<&mut Vec<Box<dyn Buttonlike>>>

Returns a mutable reference to the Buttonlike inputs mapped to action

source

pub fn get_axislike(&self, action: &A) -> Option<&Vec<Box<dyn Axislike>>>

Returns a reference to the Axislike inputs associated with the given action.

source

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

source

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.

source

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

source

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.

source

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

pub fn len(&self) -> usize

Count the total number of registered input bindings.

source

pub fn is_empty(&self) -> bool

Returns true if the map contains no action-input bindings.

source

pub fn clear(&mut self)

Clears the map, removing all action-input bindings.

source§

impl<A: Actionlike> InputMap<A>

source

pub fn clear_action(&mut self, action: &A)

Clears all input bindings associated with the action.

source

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.

source

pub fn remove(&mut self, action: &A, input: impl Buttonlike) -> Option<usize>

Removes the input for the action if it exists

Returns Some with index if the input was found, or None if no matching input was found.

Trait Implementations§

source§

impl<A: Clone + Actionlike> Clone for InputMap<A>

source§

fn clone(&self) -> InputMap<A>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A: Actionlike> Component for InputMap<A>
where Self: Send + Sync + 'static,

source§

const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table

A constant indicating the storage type used for this component.
source§

fn register_component_hooks(_hooks: &mut ComponentHooks)

Called when registering this component, allowing mutable access to its ComponentHooks.
source§

impl<A: Debug + Actionlike> Debug for InputMap<A>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A: Actionlike> Default for InputMap<A>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<A: Actionlike, U: Buttonlike> From<HashMap<A, Vec<U>>> for InputMap<A>

source§

fn from(raw_map: HashMap<A, Vec<U>>) -> Self

Converts a HashMap mapping actions to multiple Buttonlikes 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>

source§

fn from_iter<T: IntoIterator<Item = (A, U)>>(iter: T) -> Self

Creates a value from an iterator. Read more
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,

source§

fn from_reflect(reflect: &dyn Reflect) -> Option<Self>

Constructs a concrete instance of Self from a reflected value.
source§

fn take_from_reflect( reflect: Box<dyn Reflect>, ) -> Result<Self, Box<dyn Reflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
source§

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

Returns the default TypeRegistration for this type.
source§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
source§

impl<A: PartialEq + Actionlike> PartialEq for InputMap<A>

source§

fn eq(&self, other: &InputMap<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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,

source§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the TypeInfo of the type represented by this value. Read more
source§

fn into_any(self: Box<Self>) -> Box<dyn Any>

Returns the value as a Box<dyn Any>.
source§

fn as_any(&self) -> &dyn Any

Returns the value as a &dyn Any.
source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns the value as a &mut dyn Any.
source§

fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>

Casts this type to a boxed reflected value.
source§

fn as_reflect(&self) -> &dyn Reflect

Casts this type to a reflected value.
source§

fn as_reflect_mut(&mut self) -> &mut dyn Reflect

Casts this type to a mutable reflected value.
source§

fn clone_value(&self) -> Box<dyn Reflect>

Clones the value as a Reflect trait object. Read more
source§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
source§

fn try_apply(&mut self, value: &dyn Reflect) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
source§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
source§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
source§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
source§

fn reflect_owned(self: Box<Self>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
source§

fn reflect_partial_eq(&self, value: &dyn Reflect) -> Option<bool>

Returns a “partial equality” comparison result. Read more
source§

fn apply(&mut self, value: &(dyn Reflect + 'static))

Applies a reflected value to this value. Read more
source§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
source§

fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Debug formatter for the value. Read more
source§

fn serializable(&self) -> Option<Serializable<'_>>

Returns a serializable version of the value. Read more
source§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
source§

impl<A> Serialize for InputMap<A>
where A: Serialize + Actionlike,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
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,

source§

fn field(&self, name: &str) -> Option<&dyn Reflect>

Returns a reference to the value of the field named name as a &dyn Reflect.
source§

fn field_mut(&mut self, name: &str) -> Option<&mut dyn Reflect>

Returns a mutable reference to the value of the field named name as a &mut dyn Reflect.
source§

fn field_at(&self, index: usize) -> Option<&dyn Reflect>

Returns a reference to the value of the field with index index as a &dyn Reflect.
source§

fn field_at_mut(&mut self, index: usize) -> Option<&mut dyn Reflect>

Returns a mutable reference to the value of the field with index index as a &mut dyn Reflect.
source§

fn name_at(&self, index: usize) -> Option<&str>

Returns the name of the field with index index.
source§

fn field_len(&self) -> usize

Returns the number of fields in the struct.
source§

fn iter_fields(&self) -> FieldIter<'_>

Returns an iterator over the values of the reflectable fields for this struct.
source§

fn clone_dynamic(&self) -> DynamicStruct

Clones the struct into a DynamicStruct.
source§

impl<A> TypePath for InputMap<A>
where Self: Any + Send + Sync, A: TypePath + Actionlike,

source§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
source§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
source§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
source§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
source§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
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,

source§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
source§

impl<A: Actionlike> VisitAssetDependencies for InputMap<A>

source§

fn visit_dependencies(&self, visit: &mut impl FnMut(UntypedAssetId))

source§

impl<A: Actionlike> Asset for InputMap<A>

source§

impl<A: Eq + Actionlike> Eq for InputMap<A>

source§

impl<A: Actionlike> Resource for InputMap<A>
where Self: Send + Sync + 'static,

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the 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 A
where A: Asset,

source§

fn insert(self: Box<A>, id: UntypedAssetId, world: &mut World)

source§

fn asset_type_name(&self) -> &'static str

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<C> Bundle for C
where C: Component,

source§

fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )

source§

unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
where F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a>,

source§

fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )

Gets this Bundle’s component ids. This will be None if the component has not been registered.
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> DynEq for T
where T: Any + Eq,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts the type to dyn Any.
source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
source§

impl<T> DynEq for T
where T: Eq + 'static,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

source§

impl<C> DynamicBundle for C
where C: Component,

source§

fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))

source§

impl<T> DynamicTypePath for T
where T: TypePath,

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromWorld for T
where T: Default,

source§

fn from_world(_world: &mut World) -> T

Creates Self using data from the given World.
source§

impl<S> GetField for S
where S: Struct,

source§

fn get_field<T>(&self, name: &str) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field named name, downcast to T.
source§

fn get_field_mut<T>(&mut self, name: &str) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field named name, downcast to T.
source§

impl<T> GetPath for T
where T: Reflect + ?Sized,

source§

fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
source§

fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
source§

fn path<'p, T>( &self, path: impl ReflectPath<'p>, ) -> Result<&T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
source§

fn path_mut<'p, T>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ConditionalSend for T
where T: Send,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

source§

impl<T> Settings for T
where T: 'static + Send + Sync,

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,