pub struct ParsedArgs<'a, const ARG_COUNT_MAX: usize = 8> { /* private fields */ }Expand description
Defines the result of argument parsing. This is a simple key-value store that offers a look-up over parsed arguments.
Implementations§
Source§impl<'a> ParsedArgs<'a>
impl<'a> ParsedArgs<'a>
Sourcepub fn parse<I>(tokens: I) -> Self
pub fn parse<I>(tokens: I) -> Self
Parse the command line input from a token stream. The result is the set of found arguments.
Sourcepub fn get<'k, T>(&self, key: &'k str) -> Result<Option<T>, Error>where
T: FromStr,
'a: 'k,
pub fn get<'k, T>(&self, key: &'k str) -> Result<Option<T>, Error>where
T: FromStr,
'a: 'k,
Try to get and parse the argument value if any.
Sourcepub fn is_enabled<'k>(&self, key: &'k str) -> boolwhere
'a: 'k,
pub fn is_enabled<'k>(&self, key: &'k str) -> boolwhere
'a: 'k,
Check if there exists an argument with the given key (i.e. short or long flag).
Trait Implementations§
Source§impl<'a, const ARG_COUNT_MAX: usize> Debug for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> Debug for ParsedArgs<'a, ARG_COUNT_MAX>
Source§impl<'a, const ARG_COUNT_MAX: usize> Default for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> Default for ParsedArgs<'a, ARG_COUNT_MAX>
Source§fn default() -> ParsedArgs<'a, ARG_COUNT_MAX>
fn default() -> ParsedArgs<'a, ARG_COUNT_MAX>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a, const ARG_COUNT_MAX: usize> Freeze for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> RefUnwindSafe for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> Send for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> Sync for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> Unpin for ParsedArgs<'a, ARG_COUNT_MAX>
impl<'a, const ARG_COUNT_MAX: usize> UnwindSafe for ParsedArgs<'a, ARG_COUNT_MAX>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more