Struct rustfmt::Options [−][src]
pub(crate) struct Options {
pub(crate) grps: Vec<OptGroup, Global>,
pub(crate) parsing_style: ParsingStyle,
pub(crate) long_only: bool,
}Expand description
A description of the options that a program can handle.
Fields
grps: Vec<OptGroup, Global>parsing_style: ParsingStylelong_only: boolImplementations
Set the parsing style.
Set or clear “long options only” mode.
In “long options only” mode, short options cannot be clustered together, and long options can be given with either a single “-” or the customary “–”. This mode also changes the meaning of “-a=b”; in the ordinary mode this will parse a short option “-a” with argument “=b”; whereas in long-options-only mode the argument will be simply “b”.
Create a generic option group, stating all parameters explicitly.
Create a long option that is optional and does not take an argument.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage help
Create a long option that can occur more than once and does not take an argument.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage help
Create a long option that is optional and takes an optional argument.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage helphint- Hint that is used in place of the argument in the usage help, e.g."FILE"for a-o FILEoption
Create a long option that is optional, takes an argument, and may occur multiple times.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage helphint- Hint that is used in place of the argument in the usage help, e.g."FILE"for a-o FILEoption
Create a long option that is optional and takes an argument.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage helphint- Hint that is used in place of the argument in the usage help, e.g."FILE"for a-o FILEoption
Create a long option that is required and takes an argument.
short_name- e.g."h"for a-hoption, or""for nonelong_name- e.g."help"for a--helpoption, or""for nonedesc- Description for usage helphint- Hint that is used in place of the argument in the usage help, e.g."FILE"for a-o FILEoption
pub fn parse<C>(&self, args: C) -> Result<Matches, Fail> where
C: IntoIterator,
<C as IntoIterator>::Item: AsRef<OsStr>,
pub fn parse<C>(&self, args: C) -> Result<Matches, Fail> where
C: IntoIterator,
<C as IntoIterator>::Item: AsRef<OsStr>,
Parse command line arguments according to the provided options.
On success returns Ok(Matches). Use methods such as opt_present
opt_str, etc. to interrogate results.
Panics
Returns Err(Fail) on failure: use the Debug implementation of Fail
to display information about it.
Derive a short one-line usage summary from a set of long options.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Options
impl UnwindSafe for Options
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes