pub struct LayoutBindings<A: ActionSet> { /* private fields */ }Expand description
One layout’s player-edited bindings: every rebindable action’s slots, plus the keys of the actions that can’t be rebound (Debug), from the keymap file.
The pure editing API for the Key bindings screen (0815): bind,
clear, defaults (restore defaults), unmapped_required.
Implementations§
Source§impl<A: ActionSet> LayoutBindings<A>
impl<A: ActionSet> LayoutBindings<A>
Sourcepub fn defaults(def: &KeymapDef<A>, layout: Layout) -> Self
pub fn defaults(def: &KeymapDef<A>, layout: Layout) -> Self
layout’s default keys from keymap.ron, each action’s chords in
its slots in file order.
Sourcepub fn from_def(
def: &KeymapDef<A>,
layout: Layout,
fixed_reserved: bool,
) -> Self
pub fn from_def( def: &KeymapDef<A>, layout: Layout, fixed_reserved: bool, ) -> Self
defaults, with the chords of the actions that
can’t be rebound reserved or not.
Sourcepub fn is_reserved(&self, chord: Chord) -> bool
pub fn is_reserved(&self, chord: Chord) -> bool
Whether chord can never be put in a slot: a fixed chord (plain
Escape or Delete; their Shift+ chords are ordinary), or the
chord of an action that can’t be rebound (Debug) in a build with
debug tools.
Sourcepub fn find(&self, group: A::Group, chord: Chord) -> Option<(A, usize)>
pub fn find(&self, group: A::Group, chord: Chord) -> Option<(A, usize)>
The slot of one of group’s actions holding chord, if any.
Sourcepub fn bind(
&mut self,
action: A,
i: usize,
chord: Chord,
) -> Result<Option<(A, usize)>, BindError<A>>
pub fn bind( &mut self, action: A, i: usize, chord: Chord, ) -> Result<Option<(A, usize)>, BindError<A>>
Puts chord in action’s slot i, replacing what was there. If
chord was in another slot (of any action of action’s
group, including action), that slot is emptied and
returned: the key moves (docs/design/controls.md), which may
leave that action with no key. An action of another group keeps it.
Sourcepub fn clear(&mut self, action: A, i: usize)
pub fn clear(&mut self, action: A, i: usize)
Empties action’s slot i (nothing happens for a slot that doesn’t
exist).
Sourcepub fn is_unmapped(&self, action: A) -> bool
pub fn is_unmapped(&self, action: A) -> bool
Whether every slot of action is empty (shows ! not mapped).
Sourcepub fn unmapped_required(&self) -> Vec<A>
pub fn unmapped_required(&self) -> Vec<A>
The required actions with no key, in
ActionSet::ALL order. The Key bindings screen can’t be left while
this isn’t empty.
Sourcepub fn keymap(&self, repeat: RepeatDef) -> Keymap<A>
pub fn keymap(&self, repeat: RepeatDef) -> Keymap<A>
The keymap these bindings give: every slot, the chords of the
actions that can’t be rebound (unless a slot took one), and the
fixed keys (Keymap::new). Keys only:
controller buttons don’t belong to a layout (PadBindings,
Keymap::with_pad).
Trait Implementations§
Source§impl<A: Clone + ActionSet> Clone for LayoutBindings<A>
impl<A: Clone + ActionSet> Clone for LayoutBindings<A>
Source§fn clone(&self) -> LayoutBindings<A>
fn clone(&self) -> LayoutBindings<A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more