pub struct KeyMap<A> { /* private fields */ }Expand description
A declarative binding map: chords to actions with priorities and
contexts. Actions are any Clone type (usually an app enum).
Implementations§
Source§impl<A> KeyMap<A>
impl<A> KeyMap<A>
Sourcepub fn with_config(config: KeyMapConfig) -> Self
pub fn with_config(config: KeyMapConfig) -> Self
An empty map with the given timing.
Sourcepub fn config(&self) -> &KeyMapConfig
pub fn config(&self) -> &KeyMapConfig
Timing configuration.
Sourcepub fn context(&mut self, name: &str) -> ContextId
pub fn context(&mut self, name: &str) -> ContextId
Intern a context name; the same name always yields the same id.
Sourcepub fn context_name(&self, id: ContextId) -> Option<&str>
pub fn context_name(&self, id: ContextId) -> Option<&str>
Name of an interned context.
Sourcepub fn bind(&mut self, chord: Chord, action: A) -> BindingId
pub fn bind(&mut self, chord: Chord, action: A) -> BindingId
Bind a chord at Priority::Global with no context.
Sourcepub fn bind_in(
&mut self,
chord: Chord,
action: A,
priority: Priority,
context: Option<ContextId>,
) -> BindingId
pub fn bind_in( &mut self, chord: Chord, action: A, priority: Priority, context: Option<ContextId>, ) -> BindingId
Bind a chord with an explicit priority and optional context.
Sourcepub fn set_label(&mut self, id: BindingId, label: impl Into<String>) -> bool
pub fn set_label(&mut self, id: BindingId, label: impl Into<String>) -> bool
Attach a label to a binding; false if the id is unknown.
Sourcepub fn lookup(&self, chord: &Chord, active: &[ContextId]) -> Lookup<'_, A>
pub fn lookup(&self, chord: &Chord, active: &[ContextId]) -> Lookup<'_, A>
Resolve chord against the bindings applicable under active
contexts: the winning exact binding and how many longer bound chords
start with it.
Sourcepub fn conflicts(&self) -> ConflictReport
pub fn conflicts(&self) -> ConflictReport
Report shadowed, duplicate, and prefix-colliding bindings.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for KeyMap<A>
impl<A> RefUnwindSafe for KeyMap<A>
impl<A> Send for KeyMap<A>
impl<A> Sync for KeyMap<A>
impl<A> Unpin for KeyMap<A>
impl<A> UnsafeUnpin for KeyMap<A>
impl<A> UnwindSafe for KeyMap<A>
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