pub struct Cmd<C> { /* private fields */ }Expand description
A named subcommand (or the implicit root command).
Options registered on a Cmd are only matched when that subcommand is
active. The root Cmd is always active.
Implementations§
Source§impl<C: 'static> Cmd<C>
impl<C: 'static> Cmd<C>
Sourcepub fn add_option<T, F>(&mut self, names: &str, field: F, description: &str)
pub fn add_option<T, F>(&mut self, names: &str, field: F, description: &str)
Register a named option that writes through a field accessor.
names is a comma-separated list of aliases, e.g. "-s,--steps".
Sourcepub fn add_flag<F>(&mut self, names: &str, field: F, description: &str)
pub fn add_flag<F>(&mut self, names: &str, field: F, description: &str)
Register a bool flag (no value argument; presence sets true).
Sourcepub fn add_multi<F>(&mut self, names: &str, field: F, description: &str)
pub fn add_multi<F>(&mut self, names: &str, field: F, description: &str)
Register a multi-option that appends to a Vec<String>.
Sourcepub fn add_positional<T, F>(
&mut self,
name: &str,
field: F,
description: &str,
required: bool,
)
pub fn add_positional<T, F>( &mut self, name: &str, field: F, description: &str, required: bool, )
Register a positional argument.
Auto Trait Implementations§
impl<C> !RefUnwindSafe for Cmd<C>
impl<C> !Send for Cmd<C>
impl<C> !Sync for Cmd<C>
impl<C> !UnwindSafe for Cmd<C>
impl<C> Forget for Cmd<C>
impl<C> Freeze for Cmd<C>
impl<C> Move for Cmd<C>
impl<C> Unpin for Cmd<C>
impl<C> UnsafeUnpin for Cmd<C>where
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Opt<C>>: UnsafeUnpin,
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