pub trait Commandwhere
Self: Sized,{
type Error;
// Required methods
fn command() -> App<'static, 'static>;
fn new(mch: &ArgMatches<'_>) -> Result<Self, Self::Error>;
// Provided methods
fn parse<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I,
) -> Result<Self, Error<Self::Error>> { ... }
fn parse_args() -> Result<Self, Error<Self::Error>> { ... }
fn parse_any<I: IntoIterator<Item = T>, T: Into<OsString> + Clone, E: From<Self::Error> + From<Error>>(
itr: I,
) -> Result<Self, E> { ... }
fn parse_any_args<E: From<Self::Error> + From<Error>>() -> Result<Self, E> { ... }
fn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I,
) -> Self
where Self::Error: Display { ... }
fn parse_args_or_exit() -> Self
where Self::Error: Display { ... }
}
Expand description
Commands are main result of typeparam!
macro.
Required Associated Types§
Required Methods§
Sourcefn new(mch: &ArgMatches<'_>) -> Result<Self, Self::Error>
fn new(mch: &ArgMatches<'_>) -> Result<Self, Self::Error>
Creates structure based on matched arguments.
Provided Methods§
Sourcefn parse<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I,
) -> Result<Self, Error<Self::Error>>
fn parse<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>( itr: I, ) -> Result<Self, Error<Self::Error>>
Starts the automated parsing process with passed iterator.
NOTE --help
and --version
are returned as errors.
NOTE Note that first element of iteration is considered name of binary.
Sourcefn parse_args() -> Result<Self, Error<Self::Error>>
fn parse_args() -> Result<Self, Error<Self::Error>>
Starts the automated parsing process with commandline arguments.
NOTE --help
and --version
are returned as errors.
NOTE Note that command name is considered just a binary name.
Sourcefn parse_any<I: IntoIterator<Item = T>, T: Into<OsString> + Clone, E: From<Self::Error> + From<Error>>(
itr: I,
) -> Result<Self, E>
fn parse_any<I: IntoIterator<Item = T>, T: Into<OsString> + Clone, E: From<Self::Error> + From<Error>>( itr: I, ) -> Result<Self, E>
Starts the automated parsing process with passed iterator.
NOTE --help
and --version
are returned as errors.
NOTE Note that first element of iteration is considered name of binary.
Sourcefn parse_any_args<E: From<Self::Error> + From<Error>>() -> Result<Self, E>
fn parse_any_args<E: From<Self::Error> + From<Error>>() -> Result<Self, E>
Starts the automated parsing process with commandline arguments.
NOTE --help
and --version
are returned as errors.
NOTE Note that command name is considered just a binary name.
Sourcefn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>(
itr: I,
) -> Self
fn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>( itr: I, ) -> Self
Starts the automated parsing process with passed iterator. If parsing fails an error is printed and process exits.
NOTE Note that command name is considered just a binary name.
Sourcefn parse_args_or_exit() -> Self
fn parse_args_or_exit() -> Self
Starts the automated parsing process with passed iterator. If parsing fails an error is printed and process exits.
NOTE Note that command name is considered just a binary name.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.