[go: up one dir, main page]

Struct clap::SubCommand

source ·
pub struct SubCommand<'n, 'a> { /* private fields */ }
Expand description

The abstract representation of a command line subcommand used by the consumer of the library.

This struct is used by the library consumer and describes all the valid options of the subcommand for their program. SubCommands are treated like “sub apps” and contain all the same possibilities (such as their own arguments and subcommands).

§Example

SubCommand::new("conifg")
               .about("Used for configuration")
               .arg(Arg::new("config_file")
                          .help("The configuration file to use")
                          .index(1))

Implementations§

source§

impl<'n, 'a> SubCommand<'n, 'a>

source

pub fn with_name<'au, 'v, 'ab, 'u, 'h, 'ar>( name: &'ar str, ) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>

Creates a new instance of a subcommand requiring a name. Will be displayed to the user when they print version or help and usage information.

§Example
SubCommand::new("config")
source

pub fn new<'au, 'v, 'ab, 'u, 'h, 'ar>( name: &'ar str, ) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>

WARNING: This function is deprecated. Use SubCommand::with_name() instead.

Creates a new instance of a subcommand requiring a name. Will be displayed to the user when they print version or help and usage information.

§Example
SubCommand::new("config")

Auto Trait Implementations§

§

impl<'n, 'a> Freeze for SubCommand<'n, 'a>

§

impl<'n, 'a> RefUnwindSafe for SubCommand<'n, 'a>

§

impl<'n, 'a> Send for SubCommand<'n, 'a>

§

impl<'n, 'a> Sync for SubCommand<'n, 'a>

§

impl<'n, 'a> Unpin for SubCommand<'n, 'a>

§

impl<'n, 'a> UnwindSafe for SubCommand<'n, '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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.