pub struct KeyMap {
pub forward: InputKey,
pub backward: InputKey,
pub left: InputKey,
pub right: InputKey,
pub sprint: InputKey,
pub jump: InputKey,
pub interact: InputKey,
}Expand description
The canonical action -> key map. Persisted in ControlsSettings and pushed to
the active backend. Each field is #[serde(default)] so adding an action in a
future build never invalidates an existing settings file (a missing field
falls back to its default rather than failing the whole load).
Fields§
§forward: InputKeyInputKey bound to Bindable::Forward.
backward: InputKeyInputKey bound to Bindable::Backward.
left: InputKeyInputKey bound to Bindable::Left.
right: InputKeyInputKey bound to Bindable::Right.
sprint: InputKeyInputKey bound to Bindable::Sprint.
jump: InputKeyInputKey bound to Bindable::Jump.
interact: InputKeyInputKey bound to Bindable::Interact.
Implementations§
Source§impl KeyMap
impl KeyMap
Sourcepub fn set(&mut self, action: Bindable, key: InputKey)
pub fn set(&mut self, action: Bindable, key: InputKey)
Bind an action to a key directly (no conflict handling).
Sourcepub fn action_for_key(self, key: InputKey) -> Option<Bindable>
pub fn action_for_key(self, key: InputKey) -> Option<Bindable>
The action a key is bound to, or None if unbound. The map keeps each key
bound to at most one action (the invariant rebind maintains), so this is
the unique holder.
Trait Implementations§
impl Copy for KeyMap
Source§impl<'de> Deserialize<'de> for KeyMap
impl<'de> Deserialize<'de> for KeyMap
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>,
impl Eq for KeyMap
impl StructuralPartialEq for KeyMap
Auto Trait Implementations§
impl Freeze for KeyMap
impl RefUnwindSafe for KeyMap
impl Send for KeyMap
impl Sync for KeyMap
impl Unpin for KeyMap
impl UnsafeUnpin for KeyMap
impl UnwindSafe for KeyMap
Blanket Implementations§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.