pub struct MapOpt<F, G, O1> { /* private fields */ }
Expand description
Implementation of Parser::map_opt
Trait Implementations§
Source§impl<I, O1, O2, E, F, G> Parser<I, O2, E> for MapOpt<F, G, O1>
impl<I, O1, O2, E, F, G> Parser<I, O2, E> for MapOpt<F, G, O1>
Source§fn parse(&mut self, input: I) -> IResult<I, O2, E>
fn parse(&mut self, input: I) -> IResult<I, O2, E>
A parser takes in input type, and returns a
Result
containing
either the remaining input and the output value, or an errorSource§fn by_ref(&mut self) -> ByRef<'_, Self>where
Self: Sized,
fn by_ref(&mut self) -> ByRef<'_, Self>where
Self: Sized,
Treat
&mut Self
as a parser Read moreSource§fn value<O2>(self, val: O2) -> Value<Self, O, O2>
fn value<O2>(self, val: O2) -> Value<Self, O, O2>
Returns the provided value if the child parser succeeds. Read more
Source§fn output_into<O2: From<O>>(self) -> OutputInto<Self, O, O2>where
Self: Sized,
fn output_into<O2: From<O>>(self) -> OutputInto<Self, O, O2>where
Self: Sized,
Convert the parser’s output to another type using
std::convert::From
Read moreSource§fn recognize(self) -> Recognize<Self, O>where
Self: Sized,
fn recognize(self) -> Recognize<Self, O>where
Self: Sized,
If the child parser was successful, return the consumed input as produced value. Read more
Source§fn with_recognized(self) -> WithRecognized<Self, O>where
Self: Sized,
fn with_recognized(self) -> WithRecognized<Self, O>where
Self: Sized,
Source§fn span(self) -> Span<Self, O>
fn span(self) -> Span<Self, O>
If the child parser was successful, return the location of the consumed input as produced value. Read more
Source§fn with_span(self) -> WithSpan<Self, O>
fn with_span(self) -> WithSpan<Self, O>
if the child parser was successful, return the location of consumed input with the output
as a tuple. Functions similarly to Parser::span except it
returns the parser output as well. Read more
Source§fn map<G, O2>(self, g: G) -> Map<Self, G, O>
fn map<G, O2>(self, g: G) -> Map<Self, G, O>
Maps a function over the result of a parser Read more
Source§fn map_res<G, O2, E2>(self, g: G) -> MapRes<Self, G, O>
fn map_res<G, O2, E2>(self, g: G) -> MapRes<Self, G, O>
Applies a function returning a
Result
over the result of a parser. Read moreSource§fn map_opt<G, O2>(self, g: G) -> MapOpt<Self, G, O>
fn map_opt<G, O2>(self, g: G) -> MapOpt<Self, G, O>
Applies a function returning an
Option
over the result of a parser. Read moreSource§fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>
fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>
Creates a second parser from the output of the first one, then apply over the rest of the input Read more
Source§fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>
fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>
Applies a second parser over the output of the first one Read more
Source§fn verify<G, O2: ?Sized>(self, second: G) -> Verify<Self, G, O2>
fn verify<G, O2: ?Sized>(self, second: G) -> Verify<Self, G, O2>
Returns the result of the child parser if it satisfies a verification function. Read more
Source§fn context<C>(self, context: C) -> Context<Self, O, C>
fn context<C>(self, context: C) -> Context<Self, O, C>
If parsing fails, add context to the error Read more
Source§fn err_into<E2: From<E>>(self) -> ErrInto<Self, E, E2>where
Self: Sized,
fn err_into<E2: From<E>>(self) -> ErrInto<Self, E, E2>where
Self: Sized,
Convert the parser’s error to another type using
std::convert::From
Source§fn dbg_err<C>(self, context: C) -> DbgErr<Self, O, C>
fn dbg_err<C>(self, context: C) -> DbgErr<Self, O, C>
Prints a message and the input if the parser fails. Read more
Auto Trait Implementations§
impl<F, G, O1> Freeze for MapOpt<F, G, O1>
impl<F, G, O1> RefUnwindSafe for MapOpt<F, G, O1>
impl<F, G, O1> Send for MapOpt<F, G, O1>
impl<F, G, O1> Sync for MapOpt<F, G, O1>
impl<F, G, O1> Unpin for MapOpt<F, G, O1>
impl<F, G, O1> UnwindSafe for MapOpt<F, G, O1>
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