Struct parser_compose::Fold
source · pub struct Fold<P, Operation, Init> { /* private fields */ }
Expand description
See fold()
Trait Implementations§
source§impl<In, Out, P, Operation, Init, Accum> Parser<In> for Fold<P, Operation, Init>where
P: Parser<In, Out = Out>,
Init: Fn() -> Accum,
Operation: Fn(Accum, Out) -> Accum,
In: Clone,
impl<In, Out, P, Operation, Init, Accum> Parser<In> for Fold<P, Operation, Init>where P: Parser<In, Out = Out>, Init: Fn() -> Accum, Operation: Fn(Accum, Out) -> Accum, In: Clone,
source§fn try_parse(&self, ctx: ParserContext<In>) -> Res<In, Self::Out>
fn try_parse(&self, ctx: ParserContext<In>) -> Res<In, Self::Out>
Recognizes a value from the input and returns the result Read more
source§fn map<F, Mapped>(self, f: F) -> Map<Self, F>where
Self: Sized,
F: Fn(Self::Out) -> Mapped,
fn map<F, Mapped>(self, f: F) -> Map<Self, F>where Self: Sized, F: Fn(Self::Out) -> Mapped,
Returns a parser that applies the the function
f
to its output Read moresource§fn or<P>(self, next: P) -> Or<Self, P>where
Self: Sized,
fn or<P>(self, next: P) -> Or<Self, P>where Self: Sized,
Returns a parser that calls the
next
parser if it failed to match its input. Read moresource§fn fold<R, Op, Init, IV>(
self,
count: R,
op: Op,
init: Init
) -> Fold<Self, Op, Init>where
R: RepetitionArgument,
Init: Fn() -> IV,
Op: Fn(IV, Self::Out) -> IV,
Self: Sized,
fn fold<R, Op, Init, IV>( self, count: R, op: Op, init: Init ) -> Fold<Self, Op, Init>where R: RepetitionArgument, Init: Fn() -> IV, Op: Fn(IV, Self::Out) -> IV, Self: Sized,
Returns a parser that succeeds if it is able to match its input
count
times. Read moresource§fn skim<R>(self, count: R) -> Fold<Self, fn(_: (), _: Self::Out), fn()>where
Self: Sized,
R: RepetitionArgument,
fn skim<R>(self, count: R) -> Fold<Self, fn(_: (), _: Self::Out), fn()>where Self: Sized, R: RepetitionArgument,
Returns a parser that succeeds if it is able to match its input
count
times, discarding
any output along the way Read moresource§fn accumulate<R>(
self,
count: R
) -> Fold<Self, fn(_: Vec<Self::Out>, _: Self::Out) -> Vec<Self::Out>, fn() -> Vec<Self::Out>>where
R: RepetitionArgument,
Self: Sized,
fn accumulate<R>( self, count: R ) -> Fold<Self, fn(_: Vec<Self::Out>, _: Self::Out) -> Vec<Self::Out>, fn() -> Vec<Self::Out>>where R: RepetitionArgument, Self: Sized,
Returns a parser that succeeds if it is able to match its input
count
times, accumulating
output into a Vec
along the way. Read moresource§fn input(self) -> Input<Self>where
Self: Sized,
fn input(self) -> Input<Self>where Self: Sized,
Returns a parser that outputs the slice of the input that was recognized. Read more
source§fn peek(self) -> Peek<Self>where
Self: Sized,
fn peek(self) -> Peek<Self>where Self: Sized,
Returns a parser that never consumes any input regardless of its outcome. It can be used to
look ahead. Read more
source§fn not(self) -> Not<Self>where
Self: Sized,
fn not(self) -> Not<Self>where Self: Sized,
Returns a parser that succeeds if it was not able to recognize its input and fails if it
was able to. It never consumes any input Read more
source§fn and_then<F, U, E>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Fn(Self::Out) -> Result<U, E>,
E: Error,
fn and_then<F, U, E>(self, f: F) -> AndThen<Self, F>where Self: Sized, F: Fn(Self::Out) -> Result<U, E>, E: Error,
Returns a parser that applies a falible function
f
to its output. The parser will report
whatever error f
fails with. Read moreimpl<P: Copy, Operation: Copy, Init: Copy> Copy for Fold<P, Operation, Init>
Auto Trait Implementations§
impl<P, Operation, Init> RefUnwindSafe for Fold<P, Operation, Init>where Init: RefUnwindSafe, Operation: RefUnwindSafe, P: RefUnwindSafe,
impl<P, Operation, Init> Send for Fold<P, Operation, Init>where Init: Send, Operation: Send, P: Send,
impl<P, Operation, Init> Sync for Fold<P, Operation, Init>where Init: Sync, Operation: Sync, P: Sync,
impl<P, Operation, Init> Unpin for Fold<P, Operation, Init>where Init: Unpin, Operation: Unpin, P: Unpin,
impl<P, Operation, Init> UnwindSafe for Fold<P, Operation, Init>where Init: UnwindSafe, Operation: UnwindSafe, P: 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