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§
source§impl 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.