[−][src]Struct getopts::Options
A description of the options that a program can handle.
Methods
impl Options
[src]
pub fn new() -> Options
[src]
Create a blank set of options.
pub fn parsing_style(&mut self, style: ParsingStyle) -> &mut Options
[src]
Set the parsing style.
pub fn opt(
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str,
hasarg: HasArg,
occur: Occur
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str,
hasarg: HasArg,
occur: Occur
) -> &mut Options
Create a generic option group, stating all parameters explicitly.
pub fn optflag(
&mut self,
short_name: &str,
long_name: &str,
desc: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str
) -> &mut Options
Create a long option that is optional and does not take an argument.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage help
pub fn optflagmulti(
&mut self,
short_name: &str,
long_name: &str,
desc: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str
) -> &mut Options
Create a long option that can occur more than once and does not take an argument.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage help
pub fn optflagopt(
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
Create a long option that is optional and takes an optional argument.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage helphint
- Hint that is used in place of the argument in the usage help, e.g."FILE"
for a-o FILE
option
pub fn optmulti(
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
Create a long option that is optional, takes an argument, and may occur multiple times.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage helphint
- Hint that is used in place of the argument in the usage help, e.g."FILE"
for a-o FILE
option
pub fn optopt(
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
Create a long option that is optional and takes an argument.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage helphint
- Hint that is used in place of the argument in the usage help, e.g."FILE"
for a-o FILE
option
pub fn reqopt(
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
[src]
&mut self,
short_name: &str,
long_name: &str,
desc: &str,
hint: &str
) -> &mut Options
Create a long option that is required and takes an argument.
short_name
- e.g."h"
for a-h
option, or""
for nonelong_name
- e.g."help"
for a--help
option, or""
for nonedesc
- Description for usage helphint
- Hint that is used in place of the argument in the usage help, e.g."FILE"
for a-o FILE
option
pub fn parse<C: IntoIterator>(&self, args: C) -> Result where
C::Item: AsRef<OsStr>,
[src]
C::Item: AsRef<OsStr>,
Parse command line arguments according to the provided options.
On success returns Ok(Matches)
. Use methods such as opt_present
opt_str
, etc. to interrogate results.
Panics
Returns Err(Fail)
on failure: use the Debug
implementation of Fail
to display information about it.
pub fn short_usage(&self, program_name: &str) -> String
[src]
Derive a short one-line usage summary from a set of long options.
pub fn usage(&self, brief: &str) -> String
[src]
Derive a usage message from a set of options.
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,