pub struct Arg { /* private fields */ }
Expand description
Implementations§
Source§impl Arg
impl Arg
Sourcepub fn new() -> Arg
pub fn new() -> Arg
Create a new arg object, note you must call further methods on this for it to be useful.
§Example
let arg = Arg::new();
Sourcepub fn param(self, name: &str) -> Arg
pub fn param(self, name: &str) -> Arg
A parameter argument, or one that does not expect any argument to come before it. Note that the order that these are added to the parser matters.
§Example
let arg = Arg::new().param("p1");
arg
is a required argument and the Parser::parse()
will return an error if it is not present.
Sourcepub fn input(self, name: &str) -> Arg
pub fn input(self, name: &str) -> Arg
An optional argument that expects a value to follow directly after it.
§Example
let arg = Arg::new().input("inp");
Upon parsing, if --inp
is one of the arguments called, arg
will be in the output with whatever string comes next in the arguments.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Arg
impl RefUnwindSafe for Arg
impl Send for Arg
impl Sync for Arg
impl Unpin for Arg
impl UnwindSafe for Arg
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