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
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