Struct rustop::Parser
[−]
[src]
pub struct Parser<'a> { /* fields omitted */ }
The command line parser.
Methods
impl<'a> Parser<'a>
[src]
fn new() -> Parser<'a>
Return a new parser.
fn opt<T>(&mut self, var: T) -> &mut Opt<'a> where
T: 'a + CommandLineArgument,
T: 'a + CommandLineArgument,
Add and return an option.
var
is the associated variablevarname
is the name of the variable as a string
fn param<T>(&mut self, var: T) -> &mut Param<'a> where
T: 'a + CommandLineArgument,
T: 'a + CommandLineArgument,
Add and return a parameter.
var
is the associated variablevarname
is the name of the variable as a string
fn auto_shorts(&mut self, auto_shorts: bool)
Set whether short options should be generated automatically.
fn stop_on(&mut self, stopon: &'a str)
Specify an additional stop string.
fn command_name(&mut self, command_name: &'a str)
Set the command name.
fn usage(&mut self, usage: &'a str)
Set the usage string.
fn synopsis(&mut self, synopsis: &'a str)
Set the synopsis string.
fn version(&mut self, version: &'a str)
Set the version string.
fn help(&mut self, help: bool)
Add help option.
fn parse<'b, I>(&mut self, args: I) -> Result<Vec<&'b str>, Error> where
I: Iterator<Item = &'b str>,
I: Iterator<Item = &'b str>,
Parse vector of command line arguments.
Returns a vector of remaining (unparsed) arguments.
fn write_usage(&self, output: &mut Write) -> Result<(), Error>
Write the usage string to some output stream.