Matches

Struct Matches 

Source
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

Source

pub fn leaf_path(&self) -> Vec<&str>

The leaf command path as Vec<&str>.

Source

pub fn view(&self) -> MatchView<'_>

Scoped view at the leaf command. Most handlers will use this.

Source

pub fn at<'a>(&'a self, path: &[&'a str]) -> MatchView<'a>

Scoped view at an explicit command path, e.g., &["remote", "add"].

Source

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.

Source

pub fn get_position_one(&self, name: &str) -> Option<&OsStr>

Get a single positional by name in the leaf scope.

Source

pub fn get_value(&self, name: &str) -> Option<&OsStr>

Get an option value in the leaf scope (first of many if repeated).

Source

pub fn get_values(&self, name: &str) -> Option<&[OsString]>

Get all values for an option in the leaf scope.

Source

pub fn is_set(&self, name: &str) -> bool

Test whether a flag/option was set in the leaf scope (from any Source).

Source

pub fn is_set_from(&self, name: &str, src: Source) -> bool

Like is_set, but only if set from a specific Source.

Trait Implementations§

Source§

impl Debug for Matches

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.