pub struct Args<'a> {
items: Box<dyn ExactSizeIterator<Item = OsString> + 'a>,
name: Option<String>,
}Expand description
All currently present command line parameters with some extra metainfo
Use it for unit tests and manual parsing. For production use you would want to replace the
program name with set_name, but for tests passing a slice of strings to
run_inner is usually more convenient.
The easiest way to create Args is by using its From instance.
let parser = short('f')
.switch()
.to_options();
let value = parser
.run_inner(Args::from(&["-f"]))
.unwrap();
assert!(value);
// this also works
let value = parser.run_inner(&["-f"])
.unwrap();
assert!(value);Fields§
§items: Box<dyn ExactSizeIterator<Item = OsString> + 'a>§name: Option<String>Implementations§
Source§impl Args<'_>
impl Args<'_>
Sourcepub fn current_args() -> Self
pub fn current_args() -> Self
Get a list of command line arguments from OS
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Args<'a>
impl<'a> !RefUnwindSafe for Args<'a>
impl<'a> !Send for Args<'a>
impl<'a> !Sync for Args<'a>
impl<'a> Unpin for Args<'a>
impl<'a> !UnwindSafe for Args<'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