pub struct ArgumentsParser<'arg, I> { /* private fields */ }Expand description
An ArgumentsParser is the main entry point into debate_parser. It parses
arguments in each call to next_arg, sending those arguments to the given
Visitor. It handles distinguishing flags, options, and positionals; logic
related to how flags get their argument values, and the --
debate-parser operates entirely on borrowed data, because we assume
that command-line arguments can be loaded early on in main and then handled
in a borrowed form for the rest of the program. The ubiquitous 'arg lifetime
refers to this borrowed command line data.
Implementations§
Source§impl<'arg, I> ArgumentsParser<'arg, I>
impl<'arg, I> ArgumentsParser<'arg, I>
Sourcepub fn new(args: impl IntoIterator<IntoIter = I>) -> Self
pub fn new(args: impl IntoIterator<IntoIter = I>) -> Self
Create a new ArgumentsParser from an iterator of byte slices, where
each byte slice is a single argument received from the command line. This
list should exclude the name of the program, which is commonly passed as
the first argument in the list.
pub fn new_from_slice( slice: &[impl AsBytes], ) -> ArgumentsParser<'_, impl Iterator<Item = &[u8]>>
pub fn next_arg<V>(&mut self, visitor: V) -> Option<V::Value>where
V: Visitor<'arg>,
Trait Implementations§
Source§impl<'arg, I: Clone> Clone for ArgumentsParser<'arg, I>
impl<'arg, I: Clone> Clone for ArgumentsParser<'arg, I>
Source§fn clone(&self) -> ArgumentsParser<'arg, I>
fn clone(&self) -> ArgumentsParser<'arg, I>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more