Struct argparsnip::Args [−][src]
pub struct Args<'a, T = Results<'a>> { pub name: &'a str, pub path: Option<&'a str>, pub version: &'a str, pub about: &'a str, pub args: Vec<Arg<'a>>, pub disable_overrides: bool, pub subcommands: Vec<Args<'a, T>>, pub handler: fn(_: Results<'a>) -> T, pub filters: Filters<'a>, }
Struct defining the collection of args we support
Fields
name: &'a str
name of this command (if it’s the root) or subcommand if ommitted this will default to the cargo package name (even with subcommands)
path: Option<&'a str>
If this subcommand is matched this field will be returned alongside the Results, with the intention that it can be used to uniquely identify which Args struct was matched (although uniqueness is not enforced). This is needed because the name field can be repeated in nested subcommands, e.g ./foo help ./foo subcommand help where “help” is the name This field is also used in the –version && –help command, so we recommend that this mirrors the cli call used, e.g if name = “subcommand” then path = “root subcommand”
version: &'a str
The program version, used by the –version command if ommitted this will default to the cargo package version (even with subcommands)
about: &'a str
About string included in the –help command if ommitted this will default to the cargo package description (even with subcommands)
args: Vec<Arg<'a>>
Collections of args that we will look for under this command. Any matched will be included in the Results params or flags.
disable_overrides: bool
Whether to fail if an arg is seen multiple times. Defaults to false
subcommands: Vec<Args<'a, T>>
List of subcommands underneath this command
handler: fn(_: Results<'a>) -> T
handler to invoke when this command has been found. This is not called if a subcommand is invoked
filters: Filters<'a>
Filter conditions to restrict the combinations of args this command supports
Implementations
impl<'a, R> Args<'a, R>
[src]
pub fn parse<S: IntoStr, T: IntoIterator<Item = S>>(
&'a self,
args: T
) -> Result<R, Error<'a>>
[src]
&'a self,
args: T
) -> Result<R, Error<'a>>
Trait Implementations
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Args<'a, T>
impl<'a, T> Send for Args<'a, T>
impl<'a, T> Sync for Args<'a, T>
impl<'a, T> Unpin for Args<'a, T>
impl<'a, T> UnwindSafe for Args<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<'a, T> Handler<'a, T> for T where
T: Default,
[src]
T: Default,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,