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

Source

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

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

Fetches the gamepad Entity associated with the one controlled by this input map.

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

Source

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.

Source

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.

Source

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>

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

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,

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

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

type Mutability = Mutable

A marker type to assist Bevy with determining if this component is mutable, or immutable. Mutable components will have [Component<Mutability = Mutable>], while immutable components will instead have [Component<Mutability = Immutable>]. Read more
Source§

fn register_required_components( requiree: ComponentId, components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, inheritance_depth: u16, recursion_check_stack: &mut Vec<ComponentId>, )

Registers required components.
Source§

fn clone_behavior() -> ComponentCloneBehavior

Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
Source§

fn register_component_hooks(hooks: &mut ComponentHooks)

👎Deprecated since 0.16.0: Use the individual hook methods instead (e.g., Component::on_add, etc.)
Called when registering this component, allowing mutable access to its ComponentHooks.
Source§

fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_add ComponentHook for this Component if one is defined.
Source§

fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_insert ComponentHook for this Component if one is defined.
Source§

fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_replace ComponentHook for this Component if one is defined.
Source§

fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_remove ComponentHook for this Component if one is defined.
Source§

fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_despawn ComponentHook for this Component if one is defined.
Source§

fn map_entities<E>(_this: &mut Self, _mapper: &mut E)
where E: EntityMapper,

Maps the entities on this component using the given 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 more
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::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>

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

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

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

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

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

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

fn try_apply(&mut self, value: &dyn PartialReflect) -> 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 try_into_reflect( self: Box<Self>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>

Attempts to cast this type to a boxed, fully-reflected value.
Source§

fn try_as_reflect(&self) -> Option<&dyn Reflect>

Attempts to cast this type to a fully-reflected value.
Source§

fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>

Attempts to cast this type to a mutable, fully-reflected value.
Source§

fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>

Casts this type to a boxed, reflected value. Read more
Source§

fn as_partial_reflect(&self) -> &dyn PartialReflect

Casts this type to a reflected value. Read more
Source§

fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect

Casts this type to a mutable, reflected value. Read more
Source§

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

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

fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>

Attempts to clone Self using reflection. Read more
Source§

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

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

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

👎Deprecated since 0.16.0: to clone reflected values, prefer using reflect_clone. To convert reflected values to dynamic ones, use to_dynamic.
Clones Self into its dynamic representation. Read more
Source§

fn to_dynamic(&self) -> Box<dyn PartialReflect>

Converts this reflected value into its dynamic representation based on its kind. 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 is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
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,

Source§

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

Returns the value as a Box<dyn Any>. Read more
Source§

fn as_any(&self) -> &dyn Any

Returns the value as a &dyn Any. Read more
Source§

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

Returns the value as a &mut dyn Any. Read more
Source§

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

Casts this type to a boxed, fully-reflected value.
Source§

fn as_reflect(&self) -> &dyn Reflect

Casts this type to a fully-reflected value.
Source§

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

Casts this type to a mutable, fully-reflected value.
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§

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

Returns a reference to the value of the field named name as a &dyn PartialReflect.
Source§

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

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

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

Returns a reference to the value of the field with index index as a &dyn PartialReflect.
Source§

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

Returns a mutable reference to the value of the field with index index as a &mut dyn PartialReflect.
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 to_dynamic_struct(&self) -> DynamicStruct

Source§

fn clone_dynamic(&self) -> DynamicStruct

👎Deprecated since 0.16.0: use to_dynamic_struct instead
Clones the struct into a DynamicStruct.
Source§

fn get_represented_struct_info(&self) -> Option<&'static StructInfo>

Will return None if TypeInfo is not available.
Source§

impl<A> TypePath for InputMap<A>
where InputMap<A>: 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 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 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 ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )

Source§

fn register_required_components( components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, )

Registers components that are required by the components in this Bundle.
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<C> BundleFromComponents for C
where C: Component,

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§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

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

Source§

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

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

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

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

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

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<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§

type Effect = ()

An operation on the entity that happens after inserting this bundle.
Source§

fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect

Source§

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

Source§

impl<T> DynamicTyped for T
where T: Typed,

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 default().

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 PartialReflect + '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 PartialReflect + '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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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> Reflectable for T

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,