pub struct App<'a> { /* private fields */ }Expand description
The main object used to represent the program.
All consumers of the crate need to create a single object of this type.
Implementations§
Source§impl<'a> App<'a>
impl<'a> App<'a>
Sourcepub fn args(self, args: Args) -> Self
pub fn args(self, args: Args) -> Self
Specify a set of argument handlers to parse the command-line with.
Sourcepub fn ignore_unknown_options(self) -> Self
pub fn ignore_unknown_options(self) -> Self
If set, don’t error if unknown options are specified - just ignore them.
§Note
This is an alternative to calling the settings() method.
Sourcepub fn ignore_unknown_posn_args(self) -> Self
pub fn ignore_unknown_posn_args(self) -> Self
If set, don’t error if unknown positional arguments are specified - just ignore them.
§Note
This is an alternative to calling the settings() method.
Sourcepub fn no_strict_options(self) -> Self
pub fn no_strict_options(self) -> Self
Sourcepub fn generate_help<W>(&self, writer: &mut W) -> Result<()>
pub fn generate_help<W>(&self, writer: &mut W) -> Result<()>
Sourcepub fn parse_with_args(&mut self, cli_args: Vec<String>) -> Result<()>
pub fn parse_with_args(&mut self, cli_args: Vec<String>) -> Result<()>
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.
Trait Implementations§
impl<'a> StructuralPartialEq for App<'a>
Auto Trait Implementations§
impl<'a> Freeze for App<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more