pub struct Matches { /* private fields */ }Expand description
All parsed values and their sources. Internally keyed by flattened strings.
We add leaf_path so callers can query scoped without spelling keys.
Implementations§
Source§impl Matches
impl Matches
Sourcepub fn view(&self) -> MatchView<'_>
pub fn view(&self) -> MatchView<'_>
Scoped view at the leaf command. Most handlers will use this.
Sourcepub fn at<'a>(&'a self, path: &[&'a str]) -> MatchView<'a>
pub fn at<'a>(&'a self, path: &[&'a str]) -> MatchView<'a>
Scoped view at an explicit command path, e.g., &["remote", "add"].
Sourcepub fn get_position(&self, name: &str) -> Option<&[OsString]>
pub fn get_position(&self, name: &str) -> Option<&[OsString]>
Get a positional by name in the leaf scope as a slice (one becomes a 1‑elem slice). Returns None if not present.
Sourcepub fn get_position_one(&self, name: &str) -> Option<&OsStr>
pub fn get_position_one(&self, name: &str) -> Option<&OsStr>
Get a single positional by name in the leaf scope.
Sourcepub fn get_value(&self, name: &str) -> Option<&OsStr>
pub fn get_value(&self, name: &str) -> Option<&OsStr>
Get an option value in the leaf scope (first of many if repeated).
Sourcepub fn get_values(&self, name: &str) -> Option<&[OsString]>
pub fn get_values(&self, name: &str) -> Option<&[OsString]>
Get all values for an option in the leaf scope.
Sourcepub fn is_set(&self, name: &str) -> bool
pub fn is_set(&self, name: &str) -> bool
Test whether a flag/option was set in the leaf scope (from any Source).
Sourcepub fn is_set_from(&self, name: &str, src: Source) -> bool
pub fn is_set_from(&self, name: &str, src: Source) -> bool
Like is_set, but only if set from a specific Source.
Sourcepub fn flag_count(&self, name: &str) -> usize
pub fn flag_count(&self, name: &str) -> usize
Number of times a flag appeared in the leaf scope.
NOTE: only flags are counted; options with values return 0.