pub struct Matches { /* private fields */ }Expand description
Parse result containing matched arguments
Uses HashMap for O(1) argument lookups. Stores the active subcommand and all parsed argument values.
Implementations§
Source§impl Matches
impl Matches
pub fn subcommand(&self) -> Option<&str>
pub fn is_present(&self, name: &str) -> bool
pub fn value_of(&self, name: &str) -> Option<&str>
pub fn values(&self) -> &[String]
Sourcepub fn value_source(&self, name: &str) -> Option<&ValueSource>
pub fn value_source(&self, name: &str) -> Option<&ValueSource>
Get the source of where the value came from
Sourcepub fn any_present(&self, names: &[&str]) -> bool
pub fn any_present(&self, names: &[&str]) -> bool
Sourcepub fn all_present(&self, names: &[&str]) -> bool
pub fn all_present(&self, names: &[&str]) -> bool
Check if all of the given argument names are present
Sourcepub fn value_or<'a>(&'a self, name: &str, default: &'a str) -> &'a str
pub fn value_or<'a>(&'a self, name: &str, default: &'a str) -> &'a str
Get value or return a default
Sourcepub fn values_count(&self) -> usize
pub fn values_count(&self) -> usize
Get the number of positional arguments
Auto Trait Implementations§
impl Freeze for Matches
impl RefUnwindSafe for Matches
impl Send for Matches
impl Sync for Matches
impl Unpin for Matches
impl UnwindSafe for Matches
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