pub struct CommandItem {
pub name: String,
pub kind: CommandKind,
pub allowed_mode: AllowedMode,
pub spec: String,
pub tags: Vec<String>,
}Expand description
Runtime command definition to be injected into a ParseContext.
The spec field uses the xparse-style argument specification string
(e.g. "m m" for two mandatory args, "s o m" for star + optional + mandatory).
Fields§
§name: StringCommand name without leading backslash
kind: CommandKindPrefix, infix, or declarative
allowed_mode: AllowedModeWhich content modes this command may appear in
spec: Stringxparse-style argument specification string
Metadata tags for transform-stage filtering
Implementations§
Source§impl CommandItem
impl CommandItem
Sourcepub fn new(
name: impl Into<String>,
kind: CommandKind,
allowed_mode: AllowedMode,
spec: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, kind: CommandKind, allowed_mode: AllowedMode, spec: impl Into<String>, ) -> Self
Create a command item with no tags.
Builder method to attach metadata tags.
Trait Implementations§
Source§impl Clone for CommandItem
impl Clone for CommandItem
Source§fn clone(&self) -> CommandItem
fn clone(&self) -> CommandItem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandItem
impl Debug for CommandItem
impl Eq for CommandItem
Source§impl From<CommandItem> for ContextItem
impl From<CommandItem> for ContextItem
Source§fn from(item: CommandItem) -> Self
fn from(item: CommandItem) -> Self
Converts to this type from the input type.
Source§impl PartialEq for CommandItem
impl PartialEq for CommandItem
Source§fn eq(&self, other: &CommandItem) -> bool
fn eq(&self, other: &CommandItem) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CommandItem
Auto Trait Implementations§
impl Freeze for CommandItem
impl RefUnwindSafe for CommandItem
impl Send for CommandItem
impl Sync for CommandItem
impl Unpin for CommandItem
impl UnsafeUnpin for CommandItem
impl UnwindSafe for CommandItem
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.