Skip to main content

LayoutBindings

Struct LayoutBindings 

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

Source

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.

Source

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.

Source

pub fn slots(&self, action: A) -> Slots

action’s slots (all empty for Debug, which has none).

Source

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.

Source

pub fn find(&self, group: A::Group, chord: Chord) -> Option<(A, usize)>

The slot of one of group’s actions holding chord, if any.

Source

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.

Source

pub fn clear(&mut self, action: A, i: usize)

Empties action’s slot i (nothing happens for a slot that doesn’t exist).

Source

pub fn is_unmapped(&self, action: A) -> bool

Whether every slot of action is empty (shows ! not mapped).

Source

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.

Source

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>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + ActionSet> Debug for LayoutBindings<A>

Source§

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

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

impl<A: Eq + ActionSet> Eq for LayoutBindings<A>

Source§

impl<A: PartialEq + ActionSet> PartialEq for LayoutBindings<A>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<A: PartialEq + ActionSet> StructuralPartialEq for LayoutBindings<A>

Auto Trait Implementations§

§

impl<A> Freeze for LayoutBindings<A>

§

impl<A> RefUnwindSafe for LayoutBindings<A>
where A: RefUnwindSafe,

§

impl<A> Send for LayoutBindings<A>
where A: Send,

§

impl<A> Sync for LayoutBindings<A>
where A: Sync,

§

impl<A> Unpin for LayoutBindings<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for LayoutBindings<A>

§

impl<A> UnwindSafe for LayoutBindings<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> 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<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> DynClone for T
where T: Clone,

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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