pub struct ParsedArgs<'a, const CAPACITY: usize = 1> { /* 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 CAPACITY: usize> ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> ParsedArgs<'a, CAPACITY>
Sourcepub fn parse_from(argv: &'a [&'a str], ids: &ArgLookupTable<'static>) -> Self
pub fn parse_from(argv: &'a [&'a str], ids: &ArgLookupTable<'static>) -> Self
Parse the command line input from a token stream. The result is the set of found arguments.
Sourcepub fn try_parse_from(
argv: &'a [&'a str],
table: &ArgLookupTable<'static>,
) -> Result<Self, Error>
pub fn try_parse_from( argv: &'a [&'a str], table: &ArgLookupTable<'static>, ) -> 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 CAPACITY: usize> Debug for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> Debug for ParsedArgs<'a, CAPACITY>
Source§impl<'a, const CAPACITY: usize> Default for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> Default for ParsedArgs<'a, CAPACITY>
Source§fn default() -> ParsedArgs<'a, CAPACITY>
fn default() -> ParsedArgs<'a, CAPACITY>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a, const CAPACITY: usize> Freeze for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> RefUnwindSafe for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> Send for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> Sync for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> Unpin for ParsedArgs<'a, CAPACITY>
impl<'a, const CAPACITY: usize> UnwindSafe for ParsedArgs<'a, CAPACITY>
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