pub struct Args { /* private fields */ }Expand description
The arguments after the verb. Options are taken by name; what is left are positionals.
Implementations§
Source§impl Args
impl Args
pub fn new(items: impl IntoIterator<Item = impl Into<String>>) -> Self
Sourcepub fn flag(&mut self, names: &[&str]) -> bool
pub fn flag(&mut self, names: &[&str]) -> bool
Take a flag by any of its names (-i, --interactive).
Sourcepub fn value(&mut self, names: &[&str]) -> Result<Option<String>, String>
pub fn value(&mut self, names: &[&str]) -> Result<Option<String>, String>
Take --name VALUE or --name=VALUE (the last one wins).
Sourcepub fn number<T: FromStr>(
&mut self,
names: &[&str],
) -> Result<Option<T>, String>
pub fn number<T: FromStr>( &mut self, names: &[&str], ) -> Result<Option<T>, String>
Take --name N as a number.
Sourcepub fn positional(&mut self) -> Option<String>
pub fn positional(&mut self) -> Option<String>
Take the next positional. Take options first, so an option’s value is not mistaken for one.
Trait Implementations§
impl StructuralPartialEq for Args
Auto Trait Implementations§
impl Forget for Args
impl Freeze for Args
impl Move for Args
impl RefUnwindSafe for Args
impl Send for Args
impl Sync for Args
impl Unpin for Args
impl UnsafeUnpin for Args
impl UnwindSafe for Args
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