Skip to main content

CommandMeta

Struct CommandMeta 

Source
pub struct CommandMeta<'a> {
    pub cmd: &'a Command<'a>,
    pub about: Option<&'a str>,
    pub long_about: Option<&'a str>,
    pub hide: bool,
    pub args_override_self: bool,
    pub flags: &'a [FlagMeta<'a>],
    pub args: &'a [ArgMeta<'a>],
    pub subcommands: &'a [&'a CommandMeta<'a>],
    pub groups: &'a [GroupMeta<'a>],
    pub flatten_groups: &'a [FlattenGroup<'a>],
    pub extra: &'a CommandExtra<'a>,
}
Expand description

What a command knows about itself beyond how it parses.

Fields§

§cmd: &'a Command<'a>

The parse table this describes. Names, aliases, and structure come from here rather than being repeated.

§about: Option<&'a str>§long_about: Option<&'a str>§hide: bool

Whether the command is hidden from help and completions.

§args_override_self: bool

Whether later single-valued occurrences replace earlier ones.

§flags: &'a [FlagMeta<'a>]

Metadata for cmd.flags, in the same order.

§args: &'a [ArgMeta<'a>]

Metadata for cmd.args, in the same order.

§subcommands: &'a [&'a CommandMeta<'a>]

Metadata for cmd.subcommands, in the same order.

§groups: &'a [GroupMeta<'a>]

Sets of this command’s flags that relate to one another as a set.

Cold like everything else here: a group is checked once the last token has been read, by code the derive generates, and a successful parse never reads this.

§flatten_groups: &'a [FlattenGroup<'a>]

Which runs of Self::flags came from a flattened Args type.

Only Spec::to_kdl reads this, and only to write a flagset once instead of the same flags under every command that flattens the struct. It changes nothing about parsing: the flags are in flags either way, which is why this is a description of where they came from rather than a table anything binds against.

§extra: &'a CommandExtra<'a>

Everything a command rarely declares: deprecation, hidden aliases, spec-only metadata, help-page prose and layout settings. Shared through NO_COMMAND_EXTRA by every command that declares none of it, which includes nearly every flattened Args type, so a table pays for these fields once rather than per command.

Implementations§

Source§

impl CommandMeta<'_>

Source

pub const EMPTY: CommandMeta<'static>

Metadata for a command with nothing declared, for struct update syntax.

Trait Implementations§

Source§

impl<'a> Clone for CommandMeta<'a>

Source§

fn clone(&self) -> CommandMeta<'a>

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<'a> Copy for CommandMeta<'a>

Source§

impl<'a> Debug for CommandMeta<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CommandMeta<'a>

§

impl<'a> RefUnwindSafe for CommandMeta<'a>

§

impl<'a> Send for CommandMeta<'a>

§

impl<'a> Sync for CommandMeta<'a>

§

impl<'a> Unpin for CommandMeta<'a>

§

impl<'a> UnsafeUnpin for CommandMeta<'a>

§

impl<'a> UnwindSafe for CommandMeta<'a>

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.

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

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

fn try_from(value: U) -> Result<T, !>

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.