Skip to main content

CommandSpec

Struct CommandSpec 

Source
pub struct CommandSpec {
    pub id: CommandId,
    pub name: String,
    pub kind: CommandKind,
    pub doc: String,
    pub args_schema: Vec<ArgSpec>,
    pub source: SourceLocation,
    pub latency_class: LatencyClass,
}
Expand description

Metadata + the actual implementation of a registered command. Stored in the CommandRegistry.

Fields§

§id: CommandId

The id the registry minted at registration; unique per process.

§name: String

The canonical, namespaced name (motion:word-forward, operator:delete, ex:write, action:…). The key for CommandRegistry::id_by_name; user-typed aliases are resolved to it by the front-end.

§kind: CommandKind

Which dispatcher path handles it.

§doc: String

The help text shown by :describe-command, :apropos and completion.

§args_schema: Vec<ArgSpec>

Per-positional-argument metadata (DESIGN.md §B.1). Lifted from the per-kind spec (MotionSpec.args_schema, ExCommandSpec.args_schema, …) at registration time so callers can introspect arg shape without knowing the registration kind. Used by :describe-command, palette form rendering, and missing- arg prompts.

§source: SourceLocation

Where this command was registered (DESIGN.md §5.11). Captured via #[track_caller] for built-ins, by the plugin host for plugin-registered commands, by the config loader for user-registered commands. The field is pub for read access (introspection), but the only writers are the trusted pub(crate) insert_* registry methods – there is no public API that takes a SourceLocation parameter.

§latency_class: LatencyClass

Latency class declaration (DESIGN.md §5.2.5). Surfaced by :describe-command; future cancellation / deadline machinery reads this to set per-call budgets. v1 is purely declarative – no runtime enforcement yet.

Trait Implementations§

Source§

impl Clone for CommandSpec

Source§

fn clone(&self) -> CommandSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommandSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Introspectable for CommandSpec

Source§

fn kind_label(&self) -> &'static str

Kind label for the help-buffer heading: "command", "key", "option", "event", "mode", "buffer".
Source§

fn identifier(&self) -> String

User-facing identifier: "ex:write", "j", "editor.line-numbers".
Source§

fn doc(&self) -> &str

Multi-line documentation. May be empty (the renderer prints a (no documentation) placeholder).
Source§

fn sources(&self) -> Vec<SourceEntry<'_>>

One or more provenance entries. Empty means “no recorded origin” (common for synthesised buffers / runtime values without a trace).
Source§

fn extra_sections(&self) -> Vec<HelpSection>

Type-specific blocks: args list for commands, mode-grouped bindings for keys, value/type for options, payload for events, keymap chain for modes. Default empty.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more