Struct combine::parser::combinator::FlatMap [−][src]
pub struct FlatMap<P, F>(_, _);
Trait Implementations
type Output = B
type Output = B
The type which is returned if the parser is successful.
type PartialState = P::PartialState
type PartialState = P::PartialState
Determines the state necessary to resume parsing after more input is supplied. Read more
fn parse_partial(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_first(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_mode_impl<M>(
&mut self,
mode: M,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error> where
M: ParseMode,
Adds the first error that would normally be returned by this parser if it failed with an
PeekErr
result. Read more
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_with_state(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> Result<Self::Output, <Input as StreamOnce>::Error>
fn parse_with_state(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> Result<Self::Output, <Input as StreamOnce>::Error>
Entry point of the parser when using partial parsing. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_stream(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
Parses using the stream input
by calling Stream::uncons
one or more times. Read more
fn parse_lazy(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_lazy(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
Parses using the stream input
by calling Stream::uncons
one or more times. Read more
fn parse_stream_partial(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_stream_partial(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
Like parse_stream
but supports partial parsing.
Borrows a parser instead of consuming it. Read more
Discards the value of the self
parser and returns the value of p
.
Fails if any of the parsers fails. Read more
Discards the value of the p
parser and returns the value of self
.
Fails if any of the parsers fails. Read more
Parses with self
followed by p
.
Succeeds if both parsers succeed, otherwise fails.
Returns a tuple with both values on success. Read more
Returns a parser which attempts to parse using self
. If self
fails without committing
it tries to consume the same input using p
. Read more
Parses using self
and then passes the value to f
which returns a parser used to parse
the rest of the input. Read more
fn then_partial<N, F>(self, f: F) -> ThenPartial<Self, F> where
Self: Sized,
F: FnMut(&mut Self::Output) -> N,
N: Parser<Input>,
fn then_partial<N, F>(self, f: F) -> ThenPartial<Self, F> where
Self: Sized,
F: FnMut(&mut Self::Output) -> N,
N: Parser<Input>,
Parses using self
and then passes a reference to the value to f
which returns a parser
used to parse the rest of the input. The value is then combined with the output of f
. Read more
Uses f
to map over the parsed value. Read more
fn map_input<F, B>(self, f: F) -> MapInput<Self, F> where
Self: Sized,
F: FnMut(Self::Output, &mut Input) -> B,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
Parses with self
and if it fails, adds the message msg
to the error. Read more
Parses with self
and if it fails without consuming any input any expected errors are
replaced by msg
. msg
is then used in error messages as “Expected msg
”. Read more
Parses with self
, if it fails without consuming any input any expected errors that would
otherwise be emitted by self
are suppressed. Read more
Parses with self
and applies f
on the result if self
parses successfully.
f
may optionally fail with an error which is automatically converted to a ParseError
. Read more
fn partial_iter<'a, 's, M>(
self,
mode: M,
input: &'a mut Input,
partial_state: &'s mut Self::PartialState
) -> Iter<'a, Input, Self, &'s mut Self::PartialState, M>ⓘ where
Self: Parser<Input> + Sized,
M: ParseMode,
fn partial_iter<'a, 's, M>(
self,
mode: M,
input: &'a mut Input,
partial_state: &'s mut Self::PartialState
) -> Iter<'a, Input, Self, &'s mut Self::PartialState, M>ⓘ where
Self: Parser<Input> + Sized,
M: ParseMode,
fn boxed<'a>(
self
) -> Box<dyn Parser<Input, Output = Self::Output, PartialState = Self::PartialState> + 'a>ⓘimpl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
where
Self: Sized + 'a,
fn boxed<'a>(
self
) -> Box<dyn Parser<Input, Output = Self::Output, PartialState = Self::PartialState> + 'a>ⓘimpl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
where
Self: Sized + 'a,
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Turns the parser into a trait object by putting it in a Box
. Can be used to easily
return parsers from functions without naming the type. Read more
Auto Trait Implementations
impl<P, F> RefUnwindSafe for FlatMap<P, F> where
F: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, F> UnwindSafe for FlatMap<P, F> where
F: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more