Struct gong::options::OptionSet

source ·
pub struct OptionSet<'r, 'a: 'r> {
    pub long: &'r [LongOption<'a>],
    pub short: &'r [ShortOption],
    pub mode: OptionsMode,
    pub allow_abbreviations: bool,
}
Expand description

Option set

Used to supply the set of information about available options to match against

This is the non-“extendible” variant. Unlike its cousin OptionSetEx, this holds options lists as slice references rather than Vecs, and thus cannot be extended in size (hence no add_* methods). This is particularly useful in efficient creation of static/const option sets.

Fields§

§long: &'r [LongOption<'a>]§short: &'r [ShortOption]§mode: OptionsMode§allow_abbreviations: bool

Implementations§

Creates an “extendible” copy of self

This duplicates the options in self into an OptionSetEx.

Set mode

Enable/disable abbreviated matching

Checks if empty

Checks validity of option set

Returns true if valid.

See also the validate method.

Checks validity of option set, returning details of any problems

Analyses provided program arguments.

Returns a result set describing the result of the analysis. This may include &str references to strings provided in the args parameter and in self. Take note of this with respect to object lifetimes.

Expects self to be valid (see is_valid).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.