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, const SIZE: usize> ParsedArgs<'a, SIZE>
impl<'a, const SIZE: usize> ParsedArgs<'a, SIZE>
Sourcepub fn parse(argv: impl IntoTokens<'a>, ids: &[(Flag<'a>, &'a str)]) -> Self
pub fn parse(argv: impl IntoTokens<'a>, ids: &[(Flag<'a>, &'a str)]) -> Self
Parse the command line input from a token stream. The result is the set of found arguments.
Sourcepub fn try_parse(
argv: impl IntoTokens<'a>,
ids: &[(Flag<'a>, &'a str)],
) -> Result<Self, Error>
pub fn try_parse( argv: impl IntoTokens<'a>, ids: &[(Flag<'a>, &'a str)], ) -> Result<Self, Error>
Try to parse the input arguments.
Sourcepub fn contains(&self, id: &str) -> bool
pub fn contains(&self, id: &str) -> bool
Check if there exists an argument with the given key (i.e. short or long flag).
Sourcepub fn get_one<T>(&self, id: &str) -> Option<Option<T>>where
T: FromStr,
pub fn get_one<T>(&self, id: &str) -> Option<Option<T>>where
T: FromStr,
Get one value for the given flag identifier.
Sourcepub fn get_many<B, T>(&self, id: &str) -> Option<B>where
B: FromIterator<T>,
T: FromStr,
pub fn get_many<B, T>(&self, id: &str) -> Option<B>where
B: FromIterator<T>,
T: FromStr,
Get many values for the given flag identifier.
Sourcepub fn try_get_one<T>(&self, id: &str) -> Result<Option<Option<T>>, Error>where
T: FromStr,
pub fn try_get_one<T>(&self, id: &str) -> Result<Option<Option<T>>, Error>where
T: FromStr,
Try to get and parse the argument value if any.
Sourcepub fn try_get_many<B, T>(&self, id: &str) -> Result<Option<B>, Error>where
B: FromIterator<T>,
T: FromStr,
pub fn try_get_many<B, T>(&self, id: &str) -> Result<Option<B>, Error>where
B: FromIterator<T>,
T: FromStr,
Try to get and parse the argument value if any. The value can be constructed from an iterator.
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