Trait svc_assets::Parser
pub trait Parser: FromArgMatches + CommandFactory + Sized {
// Provided methods
fn parse() -> Self { ... }
fn try_parse() -> Result<Self, Error<RichFormatter>> { ... }
fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error<RichFormatter>>
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
fn try_update_from<I, T>(
&mut self,
itr: I
) -> Result<(), Error<RichFormatter>>
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
}
Expand description
Parse command-line arguments into Self
.
The primary one-stop-shop trait used to create an instance of a clap
[Command
], conduct the parsing, and turn the resulting [ArgMatches
] back
into concrete instance of the user struct.
This trait is primarily a convenience on top of [FromArgMatches
] +
[CommandFactory
] which uses those two underlying traits to build the two
fundamental functions parse
which uses the std::env::args_os
iterator,
and parse_from
which allows the consumer to supply the iterator (along
with fallible options for each).
See also [Subcommand
] and [Args
].
NOTE: Deriving requires the derive
feature flag
Provided Methods§
fn parse() -> Self
fn parse() -> Self
Parse from std::env::args_os()
, exit on error
fn try_parse() -> Result<Self, Error<RichFormatter>>
fn try_parse() -> Result<Self, Error<RichFormatter>>
Parse from std::env::args_os()
, return Err on error.
fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Selfwhere I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Parse from iterator, exit on error
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error<RichFormatter>>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error<RichFormatter>>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Parse from iterator, return Err on error.
fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I)where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Update from iterator, exit on error
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error<RichFormatter>>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error<RichFormatter>>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Update from iterator, return Err on error.