Struct gong::options::OptionSetEx

source ·
pub struct OptionSetEx<'a> {
    pub long: Vec<LongOption<'a>>,
    pub short: Vec<ShortOption>,
    pub mode: OptionsMode,
    pub allow_abbreviations: bool,
}
Expand description

Extendible option set

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

This is the “extendible” variant which uses Vecs to hold the option lists and thus is flexible in allowing addition of options, and may re-allocate as necessary.

Fields§

§long: Vec<LongOption<'a>>§short: Vec<ShortOption>§mode: OptionsMode§allow_abbreviations: bool

Implementations§

Create a new object. Takes estimations of the number of options to expect to be added (for efficient vector allocation).

Create an OptionSet referencing self’s vectors as slices.

Set mode

Enable/disable abbreviated matching

Checks if empty

Add a long option

Panics (debug only) on invalid name.

Add a short option

Panics (debug only) on invalid char choice.

Add a long option that expects data

Panics (debug only) on invalid name.

Add a short option that expects data

Panics (debug only) on invalid char choice.

Add an existing (ready-made) long option

Add an existing (ready-made) short option

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.