pub struct Matches {
pub(crate) opts: Vec<Opt>,
pub(crate) vals: Vec<Vec<Optval>>,
pub free: Vec<String>,
}
Expand description
The result of checking command line arguments. Contains a vector of matches and a vector of free strings.
Fields
opts: Vec<Opt>
Options that matched
vals: Vec<Vec<Optval>>
Values of the Options that matched
free: Vec<String>
Free string fragments
Implementations
sourceimpl Matches
impl Matches
pub(crate) fn opt_vals(&self, nm: &str) -> Vec<Optval>
pub(crate) fn opt_val(&self, nm: &str) -> Option<Optval>
sourcepub fn opt_defined(&self, nm: &str) -> bool
pub fn opt_defined(&self, nm: &str) -> bool
Returns true if an option was defined
sourcepub fn opt_present(&self, nm: &str) -> bool
pub fn opt_present(&self, nm: &str) -> bool
Returns true if an option was matched.
sourcepub fn opts_present(&self, names: &[String]) -> bool
pub fn opts_present(&self, names: &[String]) -> bool
Returns true if any of several options were matched.
sourcepub fn opts_str(&self, names: &[String]) -> Option<String>
pub fn opts_str(&self, names: &[String]) -> Option<String>
Returns the string argument supplied to one of several matching options or None
.
sourcepub fn opt_strs(&self, nm: &str) -> Vec<String>
pub fn opt_strs(&self, nm: &str) -> Vec<String>
Returns a vector of the arguments provided to all matches of the given option.
Used when an option accepts multiple values.
Trait Implementations
impl Eq for Matches
impl StructuralEq for Matches
impl StructuralPartialEq for Matches
Auto Trait Implementations
impl RefUnwindSafe for Matches
impl Send for Matches
impl Sync for Matches
impl Unpin for Matches
impl UnwindSafe for Matches
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more