pub trait Command: CommandInternal + Sized {
const DESC: CommandDesc;
// Provided methods
fn from_args() -> Self { ... }
fn from_iter<I>(args: I) -> Self
where I: IntoIterator<Item: Into<OsString>> { ... }
fn try_from_args() -> Result<Self> { ... }
fn try_from_iter<I>(args: I) -> Result<Self>
where I: IntoIterator<Item: Into<OsString>> { ... }
}Expand description
A CLI command.
This trait cannot be implemented by hand, it can only be #[derive]d.
Required Associated Constants§
Sourceconst DESC: CommandDesc
const DESC: CommandDesc
The command description.
Provided Methods§
Sourcefn from_args() -> Self
fn from_args() -> Self
Tries to parse an instance of Self from the arguments passed to the program
(env::args_os).
If parsing fails, an error will be printed and the process will exit with an appropriate error code.
Sourcefn from_iter<I>(args: I) -> Self
fn from_iter<I>(args: I) -> Self
Tries to parse an instance of Self from the given arguments.
The first element yielded by args is treated as the program name (argv[0]).
If parsing fails, an error will be printed and the process will exit with an appropriate error code.
Sourcefn try_from_args() -> Result<Self>
fn try_from_args() -> Result<Self>
Tries to parse an instance of Self from the arguments passed to the program
(env::args_os).
If parsing fails, an Error is returned to the caller.
Sourcefn try_from_iter<I>(args: I) -> Result<Self>
fn try_from_iter<I>(args: I) -> Result<Self>
Tries to parse an instance of Self from the given arguments.
The first element yielded by args is treated as the program name (argv[0]).
If parsing fails, an Error is returned to the caller.
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.