MatchView

Struct MatchView 

Source
pub struct MatchView<'a> { /* private fields */ }
Expand description

Read‑only scoped accessor into Matches.

Implementations§

Source§

impl MatchView<'_>

Source

pub fn path(&self) -> &[&str]

Current command path for this view.

Source

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

True if a flag/option name is present in this scope.

Source

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

True if present and from the given Source.

Source

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

Get a single option value (first of many if repeated).

Source

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

Get all option values as a slice.

Source

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

Get the first positional with name.

Source

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

Get all positionals with name as a slice (one becomes a 1‑elem slice).

Source

pub fn parse<T: FromStr>(&self, name: &str) -> Option<Result<T, T::Err>>

Typed parse helper (option). Parses the first value via FromStr.

Auto Trait Implementations§

§

impl<'a> Freeze for MatchView<'a>

§

impl<'a> RefUnwindSafe for MatchView<'a>

§

impl<'a> Send for MatchView<'a>

§

impl<'a> Sync for MatchView<'a>

§

impl<'a> Unpin for MatchView<'a>

§

impl<'a> UnwindSafe for MatchView<'a>

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.