Struct ap::App [−][src]
pub struct App<'a> { /* fields omitted */ }The main object used to represent the program.
All consumers of the crate need to create a single object of this type.
Implementations
impl<'a> App<'a>[src]
pub fn new(name: &str) -> Self[src]
Create a new application object.
pub fn args(self, args: Args) -> Self[src]
Specify a set of argument handlers to parse the command-line with.
pub fn version(self, version: &str) -> Self[src]
Specify the version of the program.
pub fn summary(self, summary: &str) -> Self[src]
Specify brief explanatory text for the program.
pub fn help(self, help: &str) -> Self[src]
Specify extended usage information for the program.
pub fn notes(self, notes: &str) -> Self[src]
Specify notes for the program.
pub fn settings(self, settings: Settings) -> Self[src]
Specify any settings for the program.
pub fn ignore_unknown_options(self) -> Self[src]
If set, don’t error if unknown options are specified - just ignore them.
Note
This is an alternative to calling the settings() method.
pub fn ignore_unknown_posn_args(self) -> Self[src]
If set, don’t error if unknown positional arguments are specified - just ignore them.
Note
This is an alternative to calling the settings() method.
pub fn generate_help(&self) -> Result<()>[src]
Generate a help/usage statement from the registered Arg’s.
This is called automatically when the user specifies -h anywhere
on the command line; you do not need to register an Arg for -h.
pub fn parse_with_args(&mut self, cli_args: Vec<String>) -> Result<()>[src]
Parse a set of command line arguments (without the program name).
Arguments
cli_args: Vector of string arguments. Specify your own, or call get_args().
Notes
- The
cli_argsvector must not specify the command name (which by default is returned as the first element byenv::args().collect()for example. Use get_args() as this handles this for you.
pub fn handler(self, boxed_handler: Box<dyn Handler + 'a>) -> Self[src]
Specify the handler for the option which must implement the Handler trait.
Note
If the handler needs to modify its own state when called, the specified boxed trait must provide a mutable reference.
pub fn parse(&mut self) -> Result<()>[src]
Simplest interface to the parser.
Trait Implementations
impl<'a> Clone for App<'a>[src]
impl<'a> Debug for App<'a>[src]
impl<'a> Default for App<'a>[src]
impl<'a> PartialEq<App<'a>> for App<'a>[src]
impl<'a> StructuralPartialEq for App<'a>[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for App<'a>
impl<'a> !Send for App<'a>
impl<'a> !Sync for App<'a>
impl<'a> Unpin for App<'a>
impl<'a> !UnwindSafe for App<'a>
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>,