pub trait CLI: Sized {
// Required method
fn parse(args: impl Iterator<Item = String>) -> Result<Parse<Self>, Error>;
// Provided method
fn process() -> Self { ... }
}
Required Methods§
Provided Methods§
Sourcefn process() -> Self
fn process() -> Self
Parses std::env::args()
as a command-line interface of the current type.
If an error occurs while parsing, it will be send to stderr and the process will exit.
If the user enters --help
or -h
, help info will be sent to stderr and the process will exit.
If you want finer control over program flow, use CLI::parse
instead.
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.