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§
Source§impl KeymapEntry
impl KeymapEntry
Sourcepub fn source(&self) -> &SourceLocation
pub fn source(&self) -> &SourceLocation
Borrow the entry’s source location. Replaces direct field
access now that source is private.
Sourcepub 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§
Source§impl Clone for KeymapEntry
impl Clone for KeymapEntry
Source§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 moreSource§impl Debug for KeymapEntry
impl Debug for KeymapEntry
impl Eq for KeymapEntry
Source§impl Introspectable for KeymapEntry
impl Introspectable for KeymapEntry
Source§fn kind_label(&self) -> &'static str
fn kind_label(&self) -> &'static str
"command", "key",
"option", "event", "mode", "buffer".Source§fn identifier(&self) -> String
fn identifier(&self) -> String
"ex:write", "j",
"editor.line-numbers".Source§fn doc(&self) -> &str
fn doc(&self) -> &str
(no documentation) placeholder).Source§fn sources(&self) -> Vec<SourceEntry<'_>>
fn sources(&self) -> Vec<SourceEntry<'_>>
Source§fn extra_sections(&self) -> Vec<HelpSection>
fn extra_sections(&self) -> Vec<HelpSection>
Source§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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