Struct KeymapEntry
pub struct KeymapEntry {
pub chord: &'static str,
pub modes: &'static [BindingMode],
pub doc: &'static str,
pub command: Option<&'static str>,
pub fall_through: bool,
/* private fields */
}Expand description
One row in the catalog. Ordering of fields matches the rendering
order in :describe-key so reading one field at a time still tells
a coherent story.
The source field is private; the keymap_entry! macro is the
only intended construction path. The macro calls the
#[doc(hidden)] KeymapEntry::__new constructor to populate
it. External crates trying to build a literal directly hit the
privacy boundary — preserving forgery-prevention per
DESIGN.md §5.11.1: every binding’s source is captured at the row’s
own file!() + line!(), not supplied ad-hoc.
Fields§
§chord: &'static strThe chord sequence in keymap notation ("j", "gg", "<C-w>j",
"<Esc>" — see the module docs). Stored unparsed; parsing happens in
the host translation pass, and lookup compares this string
verbatim, so "<C-w>" and "<c-w>" are different rows here.
modes: &'static [BindingMode]The binding-modes this row is live in. A single-mode row
(mode: Normal) carries a one-element slice; a multi-mode row
(mode: [Normal, Visual]) carries one element per mode. The
host translation pass (resolve_entries_into_bindings) fans this
out into one KeymapBinding per mode, so the per-mode trie and
:describe-key see each mode independently. Always non-empty.
doc: &'static strOne-line human description, shown by :describe-key, :keymap and
which-key. Every entry has one (the macro requires it).
command: Option<&'static str>Canonical name in the CommandRegistry. None for synthetic
actions (PushDigit, SetPending, StartMacroRecord, …) that
don’t bind a registered command.
fall_through: boolSN.3c.2b: :map-style augment-and-continue. true = after this
binding’s action runs, the dispatcher re-resolves the same chord
against the layers below the owning mode and runs the native
binding too (e.g. active-snippet-mode’s <Esc> clears the
session, then continues to the builtin <Esc> → exit insert).
false (default, set by the no-fall_through macro forms) =
the binding fully shadows its chord. Propagates to the
BoundCommand the registry stores.
Implementations§
§impl KeymapEntry
impl KeymapEntry
pub fn source(&self) -> &SourceLocation
pub fn source(&self) -> &SourceLocation
Borrow the entry’s source location. Replaces direct field
access now that source is private.
pub fn modes_label(&self) -> String
pub fn modes_label(&self) -> String
Human-readable mode list for :describe-key / :keymap and
diagnostics — e.g. "Normal" or "Normal, Visual".
Trait Implementations§
§impl Clone for KeymapEntry
impl Clone for KeymapEntry
§fn clone(&self) -> KeymapEntry
fn clone(&self) -> KeymapEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for KeymapEntry
impl Debug for KeymapEntry
impl Eq for KeymapEntry
§impl Introspectable for KeymapEntry
impl Introspectable for KeymapEntry
§fn kind_label(&self) -> &'static str
fn kind_label(&self) -> &'static str
"command", "key",
"option", "event", "mode", "buffer".§fn identifier(&self) -> String
fn identifier(&self) -> String
"ex:write", "j",
"editor.line-numbers".§fn doc(&self) -> &str
fn doc(&self) -> &str
(no documentation) placeholder).§fn sources(&self) -> Vec<SourceEntry<'_>>
fn sources(&self) -> Vec<SourceEntry<'_>>
§fn extra_sections(&self) -> Vec<HelpSection>
fn extra_sections(&self) -> Vec<HelpSection>
§impl PartialEq for KeymapEntry
impl PartialEq for KeymapEntry
impl StructuralPartialEq for KeymapEntry
Auto Trait Implementations§
impl Freeze for KeymapEntry
impl RefUnwindSafe for KeymapEntry
impl Send for KeymapEntry
impl Sync for KeymapEntry
impl Unpin for KeymapEntry
impl UnsafeUnpin for KeymapEntry
impl UnwindSafe for KeymapEntry
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.