[][src]Struct gong::options::OptionSet

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

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: OptionsModeallow_abbreviations: bool

Implementations

impl<'r, 'a: 'r> OptionSet<'r, 'a>[src]

pub fn to_extendible(&self) -> OptionSetEx<'a>[src]

Creates an “extendible” copy of self

This duplicates the options in self into an OptionSetEx.

pub fn set_mode(&mut self, mode: OptionsMode) -> &mut Self[src]

Set mode

pub fn set_allow_abbreviations(&mut self, allow: bool) -> &mut Self[src]

Enable/disable abbreviated matching

pub fn is_empty(&self) -> bool[src]

Checks if empty

pub fn is_valid(&self) -> bool[src]

Checks validity of option set

Returns true if valid.

See also the validate method.

pub fn validate(&'r self) -> Result<(), Vec<OptionFlaw<'a>>>[src]

Checks validity of option set, returning details of any problems

pub fn process<T>(&self, args: &'a [T]) -> Analysis<'a> where
    T: AsRef<str>, 
[src]

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

impl<'r, 'a: 'r> Clone for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> Debug for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> Default for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> Eq for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> PartialEq<OptionSet<'r, 'a>> for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> PartialEq<OptionSet<'r, 'a>> for OptionSetEx<'a>[src]

impl<'r, 'a: 'r> PartialEq<OptionSetEx<'a>> for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> StructuralEq for OptionSet<'r, 'a>[src]

impl<'r, 'a: 'r> StructuralPartialEq for OptionSet<'r, 'a>[src]

Auto Trait Implementations

impl<'r, 'a> RefUnwindSafe for OptionSet<'r, 'a>[src]

impl<'r, 'a> Send for OptionSet<'r, 'a>[src]

impl<'r, 'a> Sync for OptionSet<'r, 'a>[src]

impl<'r, 'a> Unpin for OptionSet<'r, 'a> where
    'a: 'r, 
[src]

impl<'r, 'a> UnwindSafe for OptionSet<'r, 'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.