Skip to main content

CommandDef

Struct CommandDef 

Source
pub struct CommandDef<C: Category, T: Tag, S: Scope> {
    pub name: &'static str,
    pub summary: &'static str,
    pub category: C,
    pub tags: &'static [T],
    pub scope: S,
    pub examples: &'static [Example],
    pub see_also: &'static [&'static str],
    pub long_description: &'static str,
    pub api: &'static [ApiEndpoint],
    pub confirmation: Option<Confirmation>,
}

Fields§

§name: &'static str§summary: &'static str§category: C§tags: &'static [T]§scope: S§examples: &'static [Example]§see_also: &'static [&'static str]§long_description: &'static str

Multi-paragraph explanation shown by the ? detail view. Lines are separated by \n. Empty string means no detail available.

§api: &'static [ApiEndpoint]

HTTP API equivalents. Empty slice means CLI-only.

§confirmation: Option<Confirmation>

Optional pre-invocation confirmation gate (CLI-only).

When set, the CLI dispatch layer should call Confirmation::prompt_stdio before running the command handler. The HTTP API ignores this field entirely.

Implementations§

Source§

impl<C: Category, T: Tag, S: Scope> CommandDef<C, T, S>

Source

pub fn requires_confirmation(&self) -> bool

Returns true if this command requires interactive confirmation before execution.

Source

pub fn gate(&self) -> Result<bool>

Run the confirmation gate if one is defined.

Returns Ok(true) if no confirmation is needed or the user confirmed, Ok(false) if the user declined.

Trait Implementations§

Source§

impl<C: Clone + Category, T: Clone + Tag, S: Clone + Scope> Clone for CommandDef<C, T, S>

Source§

fn clone(&self) -> CommandDef<C, T, S>

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<C: Copy + Category, T: Copy + Tag, S: Copy + Scope> Copy for CommandDef<C, T, S>

Source§

impl<C: Debug + Category, T: Debug + Tag, S: Debug + Scope> Debug for CommandDef<C, T, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, T, S> Freeze for CommandDef<C, T, S>
where C: Freeze, S: Freeze,

§

impl<C, T, S> RefUnwindSafe for CommandDef<C, T, S>

§

impl<C, T, S> Send for CommandDef<C, T, S>
where C: Send, S: Send, T: Sync,

§

impl<C, T, S> Sync for CommandDef<C, T, S>
where C: Sync, S: Sync, T: Sync,

§

impl<C, T, S> Unpin for CommandDef<C, T, S>
where C: Unpin, S: Unpin,

§

impl<C, T, S> UnsafeUnpin for CommandDef<C, T, S>
where C: UnsafeUnpin, S: UnsafeUnpin,

§

impl<C, T, S> UnwindSafe for CommandDef<C, T, S>

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