Trait gumdrop::Options
[−]
[src]
pub trait Options: Sized { fn parse_args<S: AsRef<str>>(
args: &[S],
style: ParsingStyle
) -> Result<Self, Error>; fn usage() -> &'static str; fn parse_args_default<S: AsRef<str>>(args: &[S]) -> Result<Self, Error> { ... } }
Implements a set of options parsed from command line arguments.
An implementation of this trait can be generated with #[derive(Options)]
from the crate gumdrop_derive
. Such a derived implementation requires that
the type implement the trait Default
.
Required Methods
fn parse_args<S: AsRef<str>>(
args: &[S],
style: ParsingStyle
) -> Result<Self, Error>
args: &[S],
style: ParsingStyle
) -> Result<Self, Error>
Parses arguments received from the command line.
The first argument (the program name) should be omitted.
fn usage() -> &'static str
Returns a string showing usage and help for each supported option.
Option descriptions are separated by newlines. The returned string should not end with a newline.
Provided Methods
fn parse_args_default<S: AsRef<str>>(args: &[S]) -> Result<Self, Error>
Parses arguments with the default ParsingStyle
.