Struct gong::options::Options [−][src]
pub struct Options<'a> { pub long: Vec<LongOption<'a>>, pub short: Vec<ShortOption>, pub mode: OptionsMode, pub allow_abbreviations: bool, }
Used to supply the set of information about available options to match against
Fields
long: Vec<LongOption<'a>>
short: Vec<ShortOption>
mode: OptionsMode
allow_abbreviations: bool
Methods
impl<'a> Options<'a>
[src]
impl<'a> Options<'a>
pub fn new(count_long: usize, count_short: usize) -> Self
[src]
pub fn new(count_long: usize, count_short: usize) -> Self
Create a new object. Takes estimations of the number of options to expect to be added (for efficient vector allocation).
pub fn set_mode(&mut self, mode: OptionsMode) -> &mut Self
[src]
pub fn set_mode(&mut self, mode: OptionsMode) -> &mut Self
Set mode
pub fn set_allow_abbreviations(&mut self, allow: bool) -> &mut Self
[src]
pub fn set_allow_abbreviations(&mut self, allow: bool) -> &mut Self
Enable/disable abbreviated matching
pub fn add_long(&mut self, name: &'a str) -> &mut Self
[src]
pub fn add_long(&mut self, name: &'a str) -> &mut Self
Add a long option
Panics (debug only) on invalid name.
pub fn add_short(&mut self, ch: char) -> &mut Self
[src]
pub fn add_short(&mut self, ch: char) -> &mut Self
Add a short option
Panics (debug only) on invalid char
choice.
pub fn add_long_data(&mut self, name: &'a str) -> &mut Self
[src]
pub fn add_long_data(&mut self, name: &'a str) -> &mut Self
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]
pub fn add_short_data(&mut self, ch: char) -> &mut Self
Add a short option that expects data
Panics (debug only) on invalid char
choice.
pub fn is_valid(&self) -> bool
[src]
pub fn is_valid(&self) -> bool
Checks validity of option set
Returns true
if valid. Outputs details of problems found to stderr
.
Trait Implementations
impl<'a> Debug for Options<'a>
[src]
impl<'a> Debug for Options<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> Clone for Options<'a>
[src]
impl<'a> Clone for Options<'a>
fn clone(&self) -> Options<'a>
[src]
fn clone(&self) -> Options<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for Options<'a>
[src]
impl<'a> PartialEq for Options<'a>
fn eq(&self, other: &Options<'a>) -> bool
[src]
fn eq(&self, other: &Options<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Options<'a>) -> bool
[src]
fn ne(&self, other: &Options<'a>) -> bool
This method tests for !=
.
impl<'a> Eq for Options<'a>
[src]
impl<'a> Eq for Options<'a>
impl<'a> Default for Options<'a>
[src]
impl<'a> Default for Options<'a>