pub struct Argv<'i> { /* private fields */ }Expand description
Implementations§
Source§impl<'i> Argv<'i>
impl<'i> Argv<'i>
Sourcepub fn new(words: &'i [&'i BStr]) -> Self
pub fn new(words: &'i [&'i BStr]) -> Self
Parse words, which should not include the program name.
Sourcepub fn words_left(&self) -> usize
pub fn words_left(&self) -> usize
How many words are left, the current one included.
Sourcepub fn stop_flags(&mut self)
pub fn stop_flags(&mut self)
Read every remaining word as a value, as if -- had been typed. An
argument declared double_dash = "automatic" or stop_flags does this
once it has a value.
Sourcepub fn resume_flags(&mut self)
pub fn resume_flags(&mut self)
Recognize flags again after -- or Argv::stop_flags: a command’s
restart_token starts a fresh invocation.
Trait Implementations§
impl<'i> Copy for Argv<'i>
impl<'i> Eq for Argv<'i>
Source§impl<'i, E> FromExternalError<Argv<'i>, E> for Error
Lets try_map report a conversion failure. It backtracks, like any winnow
error; the flag parsers in crate::combinator convert values themselves
and commit, so their errors can name the flag.
impl<'i, E> FromExternalError<Argv<'i>, E> for Error
Lets try_map report a conversion failure. It backtracks, like any winnow
error; the flag parsers in crate::combinator convert values themselves
and commit, so their errors can name the flag.
Source§fn from_external_error(input: &Argv<'i>, e: E) -> Self
fn from_external_error(input: &Argv<'i>, e: E) -> Self
ParserError::from_input but also include an external error.Source§impl Location for Argv<'_>
impl Location for Argv<'_>
Source§fn previous_token_end(&self) -> usize
fn previous_token_end(&self) -> usize
Source§fn current_token_start(&self) -> usize
fn current_token_start(&self) -> usize
Source§impl<'i, const N: usize> Parser<Argv<'i>, Arg<'i>, Error> for Named<N>
One occurrence of the flag’s name, value not yet read.
impl<'i, const N: usize> Parser<Argv<'i>, Arg<'i>, Error> for Named<N>
One occurrence of the flag’s name, value not yet read.
Source§fn parse(
&mut self,
input: I,
) -> Result<O, ParseError<I, <E as ParserError<I>>::Inner>>where
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
fn parse(
&mut self,
input: I,
) -> Result<O, ParseError<I, <E as ParserError<I>>::Inner>>where
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
Source§fn parse_iter(&mut self, input: I) -> ParseIter<'_, Self, I, O, E> ⓘwhere
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
fn parse_iter(&mut self, input: I) -> ParseIter<'_, Self, I, O, E> ⓘwhere
Self: Sized,
I: Stream + StreamIsPartial,
E: ParserError<I>,
<E as ParserError<I>>::Inner: ParserError<I>,
Source§fn parse_peek(&mut self, input: I) -> Result<(I, O), E>
fn parse_peek(&mut self, input: I) -> Result<(I, O), E>
Source§fn by_ref(&mut self) -> ByRef<'_, Self, I, O, E>where
Self: Sized,
fn by_ref(&mut self) -> ByRef<'_, Self, I, O, E>where
Self: Sized,
&mut Self as a parser Read moreSource§fn default_value<O2>(self) -> DefaultValue<Self, I, O, O2, E>
fn default_value<O2>(self) -> DefaultValue<Self, I, O, O2, E>
Source§fn void(self) -> Void<Self, I, O, E>where
Self: Sized,
fn void(self) -> Void<Self, I, O, E>where
Self: Sized,
Parser Read moreSource§fn output_into<O2>(self) -> OutputInto<Self, I, O, O2, E>
fn output_into<O2>(self) -> OutputInto<Self, I, O, O2, E>
std::convert::From Read moreSource§fn with_taken(self) -> WithTaken<Self, I, O, E>
fn with_taken(self) -> WithTaken<Self, I, O, E>
Source§fn span(self) -> Span<Self, I, O, E>
fn span(self) -> Span<Self, I, O, E>
Source§fn with_span(self) -> WithSpan<Self, I, O, E>
fn with_span(self) -> WithSpan<Self, I, O, E>
Source§fn map<G, O2>(self, map: G) -> Map<Self, G, I, O, O2, E>
fn map<G, O2>(self, map: G) -> Map<Self, G, I, O, O2, E>
Source§fn try_map<G, O2, E2>(self, map: G) -> TryMap<Self, G, I, O, O2, E, E2>where
Self: Sized,
G: FnMut(O) -> Result<O2, E2>,
I: Stream,
E: FromExternalError<I, E2> + ParserError<I>,
fn try_map<G, O2, E2>(self, map: G) -> TryMap<Self, G, I, O, O2, E, E2>where
Self: Sized,
G: FnMut(O) -> Result<O2, E2>,
I: Stream,
E: FromExternalError<I, E2> + ParserError<I>,
Result over the output of a parser. Read moreSource§fn verify_map<G, O2>(self, map: G) -> VerifyMap<Self, G, I, O, O2, E>
fn verify_map<G, O2>(self, map: G) -> VerifyMap<Self, G, I, O, O2, E>
Source§fn flat_map<G, H, O2>(self, map: G) -> FlatMap<Self, G, H, I, O, O2, E>
fn flat_map<G, H, O2>(self, map: G) -> FlatMap<Self, G, H, I, O, O2, E>
Source§fn parse_to<O2>(self) -> ParseTo<Self, I, O, O2, E>
fn parse_to<O2>(self) -> ParseTo<Self, I, O, O2, E>
std::str::FromStr to the output of the parser Read moreSource§fn verify<G, O2>(self, filter: G) -> Verify<Self, G, I, O, O2, E>
fn verify<G, O2>(self, filter: G) -> Verify<Self, G, I, O, O2, E>
Source§fn context<C>(self, context: C) -> Context<Self, I, O, E, C>
fn context<C>(self, context: C) -> Context<Self, I, O, E, C>
Source§fn context_with<F, C, FI>(
self,
context: F,
) -> ContextWith<Self, I, O, E, F, C, FI>where
Self: Sized,
I: Stream,
E: AddContext<I, C> + ParserError<I>,
F: Fn() -> FI + Clone,
C: Debug,
FI: Iterator<Item = C>,
fn context_with<F, C, FI>(
self,
context: F,
) -> ContextWith<Self, I, O, E, F, C, FI>where
Self: Sized,
I: Stream,
E: AddContext<I, C> + ParserError<I>,
F: Fn() -> FI + Clone,
C: Debug,
FI: Iterator<Item = C>,
Source§fn map_err<G, E2>(self, map: G) -> MapErr<Self, G, I, O, E, E2>
fn map_err<G, E2>(self, map: G) -> MapErr<Self, G, I, O, E, E2>
Source§fn complete_err(self) -> CompleteErr<Self, I, O, E>where
Self: Sized,
fn complete_err(self) -> CompleteErr<Self, I, O, E>where
Self: Sized,
Source§impl<'i> ParserError<Argv<'i>> for Error
impl<'i> ParserError<Argv<'i>> for Error
Source§fn or(self, other: Self) -> Self
fn or(self, other: Self) -> Self
Keep whichever of the two says more: a specific failure beats a bare “did not match”, and otherwise the later branch wins, as in winnow.
Source§fn from_input(input: &Argv<'i>) -> Self
fn from_input(input: &Argv<'i>) -> Self
Source§fn is_backtrack(&self) -> bool
fn is_backtrack(&self) -> bool
Source§fn into_inner(self) -> Result<Self::Inner, Self>
fn into_inner(self) -> Result<Self::Inner, Self>
Source§fn assert(input: &I, _message: &'static str) -> Selfwhere
I: Debug,
fn assert(input: &I, _message: &'static str) -> Selfwhere
I: Debug,
Source§fn incomplete(input: &I, _needed: Needed) -> Self
fn incomplete(input: &I, _needed: Needed) -> Self
Source§fn append(self, _input: &I, _token_start: &<I as Stream>::Checkpoint) -> Self
fn append(self, _input: &I, _token_start: &<I as Stream>::Checkpoint) -> Self
ParserError::from_input but merges it with the existing error. Read moreSource§impl<'i> Stream for Argv<'i>
Tokens are words (the unread part of the current one first); slices are
runs of whole words, so next_slice must not be asked to split a word.
impl<'i> Stream for Argv<'i>
Tokens are words (the unread part of the current one first); slices are
runs of whole words, so next_slice must not be asked to split a word.
Source§type IterOffsets = IterOffsets<'i>
type IterOffsets = IterOffsets<'i>
Source§type Checkpoint = Argv<'i>
type Checkpoint = Argv<'i>
Source§fn iter_offsets(&self) -> Self::IterOffsets
fn iter_offsets(&self) -> Self::IterOffsets
Source§fn eof_offset(&self) -> usize
fn eof_offset(&self) -> usize
Source§fn next_token(&mut self) -> Option<Self::Token>
fn next_token(&mut self) -> Option<Self::Token>
Source§fn peek_token(&self) -> Option<Self::Token>
fn peek_token(&self) -> Option<Self::Token>
Source§fn offset_for<P>(&self, predicate: P) -> Option<usize>
fn offset_for<P>(&self, predicate: P) -> Option<usize>
Source§fn offset_at(&self, tokens: usize) -> Result<usize, Needed>
fn offset_at(&self, tokens: usize) -> Result<usize, Needed>
tokens into the stream Read moreSource§fn next_slice(&mut self, offset: usize) -> Self::Slice
fn next_slice(&mut self, offset: usize) -> Self::Slice
Source§fn peek_slice(&self, offset: usize) -> Self::Slice
fn peek_slice(&self, offset: usize) -> Self::Slice
Source§fn checkpoint(&self) -> Self::Checkpoint
fn checkpoint(&self) -> Self::Checkpoint
Source§fn reset(&mut self, checkpoint: &Self::Checkpoint)
fn reset(&mut self, checkpoint: &Self::Checkpoint)
Self::Checkpoint Read moreSource§fn trace(&self, f: &mut Formatter<'_>) -> Result
fn trace(&self, f: &mut Formatter<'_>) -> Result
Source§unsafe fn next_slice_unchecked(&mut self, offset: usize) -> Self::Slice
unsafe fn next_slice_unchecked(&mut self, offset: usize) -> Self::Slice
Source§unsafe fn peek_slice_unchecked(&self, offset: usize) -> Self::Slice
unsafe fn peek_slice_unchecked(&self, offset: usize) -> Self::Slice
Source§fn peek_finish(&self) -> Self::Slicewhere
Self: Clone,
fn peek_finish(&self) -> Self::Slicewhere
Self: Clone,
Source§impl StreamIsPartial for Argv<'_>
impl StreamIsPartial for Argv<'_>
Source§type PartialState = ()
type PartialState = ()
Source§fn complete(&mut self) -> Self::PartialState
fn complete(&mut self) -> Self::PartialState
Source§fn restore_partial(&mut self, _state: Self::PartialState)
fn restore_partial(&mut self, _state: Self::PartialState)
Source§fn is_partial_supported() -> bool
fn is_partial_supported() -> bool
Stream is can ever be incompleteSource§fn is_partial(&self) -> bool
fn is_partial(&self) -> bool
Stream is currently incomplete