pub struct Keymap { /* private fields */ }Expand description
Actions and the chords that trigger them.
Implementations§
Source§impl Keymap
impl Keymap
Sourcepub fn parse(file: &str, text: &str, report: &mut Vec<Diagnostic>) -> Self
pub fn parse(file: &str, text: &str, report: &mut Vec<Diagnostic>) -> Self
Parses a keymap file. Broken entries are reported and skipped.
Sourcepub fn overlay(&mut self, other: &Self)
pub fn overlay(&mut self, other: &Self)
Replaces every action that other defines. An action bound to an empty list in
other becomes unbound.
Sourcepub fn bind(&mut self, scope: Scope, action: &str, chords: &[KeyChord])
pub fn bind(&mut self, scope: Scope, action: &str, chords: &[KeyChord])
Binds action in code, replacing any earlier binding.
Sourcepub fn action_for(&self, chord: KeyChord) -> Option<(Scope, &str)>
pub fn action_for(&self, chord: KeyChord) -> Option<(Scope, &str)>
The action chord triggers; application actions win over global ones.
Sourcepub fn chords_for(&self, scope: Scope, action: &str) -> &[KeyChord]
pub fn chords_for(&self, scope: Scope, action: &str) -> &[KeyChord]
The chords bound to action.
Sourcepub fn iter(&self) -> impl Iterator<Item = (Scope, &str, &[KeyChord])>
pub fn iter(&self) -> impl Iterator<Item = (Scope, &str, &[KeyChord])>
Every binding, sorted by scope and action.
Sourcepub fn conflicts(&self) -> Vec<Diagnostic>
pub fn conflicts(&self) -> Vec<Diagnostic>
Warnings for chords bound to more than one action within the same scope.
Trait Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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