pub struct Label<A, L>(/* private fields */);
Expand description
See Parser::labelled
.
Trait Implementations§
Source§impl<I: Clone, O, A: Parser<I, O, Error = E>, L: Into<E::Label> + Clone, E: Error<I>> Parser<I, O> for Label<A, L>
impl<I: Clone, O, A: Parser<I, O, Error = E>, L: Into<E::Label> + Clone, E: Error<I>> Parser<I, O> for Label<A, L>
Source§fn parse_recovery<'a, Iter, S>(
&self,
stream: S,
) -> (Option<O>, Vec<Self::Error>)
fn parse_recovery<'a, Iter, S>( &self, stream: S, ) -> (Option<O>, Vec<Self::Error>)
Parse a stream of tokens, yielding an output if possible, and any errors encountered along the way. Read more
Source§fn parse_recovery_verbose<'a, Iter, S>(
&self,
stream: S,
) -> (Option<O>, Vec<Self::Error>)
fn parse_recovery_verbose<'a, Iter, S>( &self, stream: S, ) -> (Option<O>, Vec<Self::Error>)
Parse a stream of tokens, yielding an output if possible, and any errors encountered along the way. Unlike
Parser::parse_recovery
, this function will produce verbose debugging output as it executes. Read moreSource§fn parse<'a, Iter, S>(&self, stream: S) -> Result<O, Vec<Self::Error>>
fn parse<'a, Iter, S>(&self, stream: S) -> Result<O, Vec<Self::Error>>
Parse a stream of tokens, yielding an output or any errors that were encountered along the way. Read more
Source§fn debug<T>(self, x: T) -> Debug<Self>
fn debug<T>(self, x: T) -> Debug<Self>
Include this parser in the debugging output produced by
Parser::parse_recovery_verbose
. Read moreSource§fn map<U, F>(self, f: F) -> Map<Self, F, O>
fn map<U, F>(self, f: F) -> Map<Self, F, O>
Map the output of this parser to another value. Read more
Source§fn map_with_span<U, F>(self, f: F) -> MapWithSpan<Self, F, O>
fn map_with_span<U, F>(self, f: F) -> MapWithSpan<Self, F, O>
Map the output of this parser to another value, making use of the pattern’s span when doing so. Read more
Source§fn map_err<F>(self, f: F) -> MapErr<Self, F>
fn map_err<F>(self, f: F) -> MapErr<Self, F>
Map the primary error of this parser to another value. Read more
Source§fn map_err_with_span<F>(self, f: F) -> MapErrWithSpan<Self, F>
fn map_err_with_span<F>(self, f: F) -> MapErrWithSpan<Self, F>
Map the primary error of this parser to another value, making use of the span from the start of the attempted
to the point at which the error was encountered. Read more
Source§fn try_map<U, F>(self, f: F) -> TryMap<Self, F, O>
fn try_map<U, F>(self, f: F) -> TryMap<Self, F, O>
After a successful parse, apply a fallible function to the output. If the function produces an error, treat it
as a parsing error. Read more
Source§fn validate<F, U>(self, f: F) -> Validate<Self, O, F>
fn validate<F, U>(self, f: F) -> Validate<Self, O, F>
Validate an output, producing non-terminal errors if it does not fulfil certain criteria. Read more
Source§fn labelled<L>(self, label: L) -> Label<Self, L>
fn labelled<L>(self, label: L) -> Label<Self, L>
Label the pattern parsed by this parser for more useful error messages. Read more
Source§fn to<U>(self, x: U) -> To<Self, O, U>
fn to<U>(self, x: U) -> To<Self, O, U>
Transform all outputs of this parser to a pretermined value. Read more
Source§fn foldl<A, B, F>(self, f: F) -> Foldl<Self, F, A, B>
fn foldl<A, B, F>(self, f: F) -> Foldl<Self, F, A, B>
Left-fold the output of the parser into a single value. Read more
Source§fn foldr<'a, A, B, F>(self, f: F) -> Foldr<Self, F, A, B>where
Self: Parser<I, (A, B)> + Sized,
A: IntoIterator,
A::IntoIter: DoubleEndedIterator,
F: Fn(A::Item, B) -> B + 'a,
fn foldr<'a, A, B, F>(self, f: F) -> Foldr<Self, F, A, B>where
Self: Parser<I, (A, B)> + Sized,
A: IntoIterator,
A::IntoIter: DoubleEndedIterator,
F: Fn(A::Item, B) -> B + 'a,
Right-fold the output of the parser into a single value. Read more
Source§fn ignored(self) -> Ignored<Self, O>where
Self: Sized,
fn ignored(self) -> Ignored<Self, O>where
Self: Sized,
Ignore the output of this parser, yielding
()
as an output instead. Read moreSource§fn collect<C>(self) -> Map<Self, fn(_: O) -> C, O>
fn collect<C>(self) -> Map<Self, fn(_: O) -> C, O>
Collect the output of this parser into a type implementing
FromIterator
. Read moreSource§fn then<U, P>(self, other: P) -> Then<Self, P>
fn then<U, P>(self, other: P) -> Then<Self, P>
Parse one thing and then another thing, yielding a tuple of the two outputs. Read more
Source§fn then_with<U, P, F: Fn(O) -> P>(
self,
other: F,
) -> ThenWith<I, O, U, Self, P, F>
fn then_with<U, P, F: Fn(O) -> P>( self, other: F, ) -> ThenWith<I, O, U, Self, P, F>
Parse one thing and then another thing, creating the second parser from the result of
the first. If you only have a couple cases to handle, prefer
Parser::or
. Read moreSource§fn flatten<T, Inner>(self) -> Map<Self, fn(_: O) -> Vec<T>, O>
fn flatten<T, Inner>(self) -> Map<Self, fn(_: O) -> Vec<T>, O>
Flatten a nested collection. Read more
Source§fn ignore_then<U, P>(self, other: P) -> IgnoreThen<Self, P, O, U>
fn ignore_then<U, P>(self, other: P) -> IgnoreThen<Self, P, O, U>
Parse one thing and then another thing, yielding only the output of the latter. Read more
Source§fn then_ignore<U, P>(self, other: P) -> ThenIgnore<Self, P, O, U>
fn then_ignore<U, P>(self, other: P) -> ThenIgnore<Self, P, O, U>
Parse one thing and then another thing, yielding only the output of the former. Read more
Source§fn padded_by<U, P>(
self,
other: P,
) -> ThenIgnore<IgnoreThen<P, Self, U, O>, P, O, U>
fn padded_by<U, P>( self, other: P, ) -> ThenIgnore<IgnoreThen<P, Self, U, O>, P, O, U>
Parse a pattern, but with an instance of another pattern on either end, yielding the output of the inner. Read more
Source§fn delimited_by<U, V, L, R>(
self,
start: L,
end: R,
) -> DelimitedBy<Self, L, R, U, V>
fn delimited_by<U, V, L, R>( self, start: L, end: R, ) -> DelimitedBy<Self, L, R, U, V>
Parse the pattern surrounded by the given delimiters. Read more
Source§fn or<P>(self, other: P) -> Or<Self, P>
fn or<P>(self, other: P) -> Or<Self, P>
Parse one thing or, on failure, another thing. Read more
Source§fn recover_with<S>(self, strategy: S) -> Recovery<Self, S>
fn recover_with<S>(self, strategy: S) -> Recovery<Self, S>
Apply a fallback recovery strategy to this parser should it fail. Read more
Source§fn or_not(self) -> OrNot<Self>where
Self: Sized,
fn or_not(self) -> OrNot<Self>where
Self: Sized,
Attempt to parse something, but only if it exists. Read more
Source§fn not(self) -> Not<Self, O>where
Self: Sized,
fn not(self) -> Not<Self, O>where
Self: Sized,
Parses a single token if, and only if, the pattern fails to parse. Read more
Source§fn repeated(self) -> Repeated<Self>where
Self: Sized,
fn repeated(self) -> Repeated<Self>where
Self: Sized,
Parse a pattern any number of times (including zero times). Read more
Source§fn separated_by<U, P>(self, other: P) -> SeparatedBy<Self, P, U>
fn separated_by<U, P>(self, other: P) -> SeparatedBy<Self, P, U>
Parse a pattern, separated by another, any number of times. Read more
Source§fn rewind(self) -> Rewind<Self>where
Self: Sized,
fn rewind(self) -> Rewind<Self>where
Self: Sized,
Parse a pattern. Afterwards, the input stream will be rewound to its original state, as if parsing had not
occurred. Read more
Source§fn boxed<'a>(self) -> BoxedParser<'a, I, O, Self::Error>where
Self: Sized + 'a,
fn boxed<'a>(self) -> BoxedParser<'a, I, O, Self::Error>where
Self: Sized + 'a,
Box the parser, yielding a parser that performs parsing through dynamic dispatch. Read more
impl<A: Copy, L: Copy> Copy for Label<A, L>
Auto Trait Implementations§
impl<A, L> Freeze for Label<A, L>
impl<A, L> RefUnwindSafe for Label<A, L>where
A: RefUnwindSafe,
L: RefUnwindSafe,
impl<A, L> Send for Label<A, L>
impl<A, L> Sync for Label<A, L>
impl<A, L> Unpin for Label<A, L>
impl<A, L> UnwindSafe for Label<A, L>where
A: UnwindSafe,
L: UnwindSafe,
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