pub enum KeymapCapability {
Full,
User,
MinorMode,
OwnedLayer {
mode_id: ModeId,
},
}Expand description
Privilege bundle a writer presents when calling
capability-gated bind APIs (slice 8.h). Mirrors the WIT
keymap-write capability variants in DESIGN.md §5.5: the
host hands one of these to every caller of the registry –
built-in startup, the user’s compiled init.rs, each loaded
plugin – and the registry enforces the layer scope before
committing any write.
Today the enforcement runs purely in-process (no WASM host
has landed yet). When the plugin host is built, the WIT
bind / unbind / push-layer / pop-layer host functions
translate the caller’s manifest-declared capability into one
of these variants and call through try_*.
Variants§
Full
Unrestricted: write to any layer. Reserved for the host’s startup pass that registers the built-in catalog.
User
Write only to KeymapLayer::User. The compiled
init.rs runs with this capability at boot. Mirror of
the WIT “user” capability; denies writes to Builtin,
MajorMode, MinorMode(_), and Buffer.
MinorMode
Write to any KeymapLayer::MinorMode or
KeymapLayer::Buffer layer. Plugins receive this when
their manifest declares keymap-write:minor-mode –
permits transient overlays (custom modes, popup
overrides) but denies writes to Builtin / MajorMode /
User.
OwnedLayer
Write only to a single specified KeymapLayer::MinorMode
identified by its ModeId. Mirror of the WIT
keymap-write:plugin-layer variant: each subsystem
(plugin, user init.rs extending an existing mode) gets
a capability scoped to one specific mode’s keymap layer
— e.g. OwnedLayer { mode_id: ModeId::new("diff-mode") }
authorises writes only to the diff-mode layer.
K.1.b (2026-05-30): re-keyed from opaque LayerId to
ModeId so the capability names the mode it targets
directly. Matches emacs’s (:map foo-mode-map ...)
shape: the binding is scoped to the mode, lives + dies
with the mode’s activation lifecycle.
Trait Implementations§
Source§impl Clone for KeymapCapability
impl Clone for KeymapCapability
Source§fn clone(&self) -> KeymapCapability
fn clone(&self) -> KeymapCapability
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for KeymapCapability
Source§impl Debug for KeymapCapability
impl Debug for KeymapCapability
impl Eq for KeymapCapability
Source§impl PartialEq for KeymapCapability
impl PartialEq for KeymapCapability
impl StructuralPartialEq for KeymapCapability
Auto Trait Implementations§
impl Freeze for KeymapCapability
impl RefUnwindSafe for KeymapCapability
impl Send for KeymapCapability
impl Sync for KeymapCapability
impl Unpin for KeymapCapability
impl UnsafeUnpin for KeymapCapability
impl UnwindSafe for KeymapCapability
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.