[−][src]Struct gong::options::OptionSetEx
Extendible option set
Used to supply the set of information about available options to match against
This is the "extendible" variant which uses Vec
s 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
impl<'a> OptionSetEx<'a>
[src]
pub fn new(count_long: usize, count_short: usize) -> Self
[src]
Create a new object. Takes estimations of the number of options to expect to be added (for efficient vector allocation).
pub fn as_fixed(&self) -> OptionSet<'_, 'a>
[src]
Create an OptionSet
referencing self
’s vectors as slices.
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 add_long(&mut self, name: &'a str) -> &mut Self
[src]
Add a long option
Panics (debug only) on invalid name.
pub fn add_short(&mut self, ch: char) -> &mut Self
[src]
Add a short option
Panics (debug only) on invalid char
choice.
pub fn add_long_data(&mut self, name: &'a str) -> &mut Self
[src]
Add a long option that expects data
Panics (debug only) on invalid name.
pub fn add_short_data(&mut self, ch: char) -> &mut Self
[src]
Add a short option that expects data
Panics (debug only) on invalid char
choice.
pub fn add_existing_long(&mut self, long: LongOption<'a>) -> &mut Self
[src]
Add an existing (ready-made) long option
pub fn add_existing_short(&mut self, short: ShortOption) -> &mut Self
[src]
Add an existing (ready-made) short option
pub fn is_valid(&self) -> bool
[src]
pub fn validate(&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]
T: AsRef<str>,
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<'a> Clone for OptionSetEx<'a>
[src]
pub fn clone(&self) -> OptionSetEx<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for OptionSetEx<'a>
[src]
impl<'a> Default for OptionSetEx<'a>
[src]
impl<'a> Eq for OptionSetEx<'a>
[src]
impl<'r, 'a: 'r> PartialEq<OptionSet<'r, 'a>> for OptionSetEx<'a>
[src]
pub fn eq(&self, rhs: &OptionSet<'r, 'a>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<OptionSetEx<'a>> for OptionSetEx<'a>
[src]
pub fn eq(&self, other: &OptionSetEx<'a>) -> bool
[src]
pub fn ne(&self, other: &OptionSetEx<'a>) -> bool
[src]
impl<'r, 'a: 'r> PartialEq<OptionSetEx<'a>> for OptionSet<'r, 'a>
[src]
pub fn eq(&self, rhs: &OptionSetEx<'a>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> StructuralEq for OptionSetEx<'a>
[src]
impl<'a> StructuralPartialEq for OptionSetEx<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for OptionSetEx<'a>
[src]
impl<'a> Send for OptionSetEx<'a>
[src]
impl<'a> Sync for OptionSetEx<'a>
[src]
impl<'a> Unpin for OptionSetEx<'a>
[src]
impl<'a> UnwindSafe for OptionSetEx<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,