Trait Command

Source
pub trait Command
where 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§

Source

type Error

Error that may be returned by the user part of the process.

Required Methods§

Source

fn command() -> App<'static, 'static>

Creates an App based on specified command

Source

fn new(mch: &ArgMatches<'_>) -> Result<Self, Self::Error>

Creates structure based on matched arguments.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn parse_or_exit<I: IntoIterator<Item = T>, T: Into<OsString> + Clone>( itr: I, ) -> Self
where Self::Error: Display,

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.

Source

fn parse_args_or_exit() -> Self
where Self::Error: Display,

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.

Implementors§