Struct nom8::combinator::Value

source ·
pub struct Value<F, O1, O2> { /* private fields */ }
Expand description

Implementation of Parser::value

Trait Implementations§

source§

impl<I, O1, O2: Clone, E: ParseError<I>, F: Parser<I, O1, E>> Parser<I, O2, E> for Value<F, O1, O2>

source§

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 error
source§

fn by_ref(&mut self) -> ByRef<'_, Self>where Self: Sized,

Treat &mut Self as a parser Read more
source§

fn value<O2>(self, val: O2) -> Value<Self, O, O2>where Self: Sized, O2: Clone,

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,

Convert the parser’s output to another type using std::convert::From Read more
source§

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,

if the child parser was successful, return the consumed input with the output as a tuple. Functions similarly to recognize except it returns the parser output as well. Read more
source§

fn map<G, O2>(self, g: G) -> Map<Self, G, O>where G: Fn(O) -> O2, Self: Sized,

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>where Self: Sized, G: FnMut(O) -> Result<O2, E2>,

Applies a function returning a Result over the result of a parser. Read more
source§

fn map_opt<G, O2>(self, g: G) -> MapOpt<Self, G, O>where Self: Sized, G: FnMut(O) -> Option<O2>,

Applies a function returning an Option over the result of a parser. Read more
source§

fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,

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>where G: Parser<O, O2, E>, Self: Sized,

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>where Self: Sized, G: Fn(&O2) -> bool,

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>where Self: Sized, C: Clone, E: ContextError<I, C>,

If parsing fails, add context to the error Read more
source§

fn complete(self) -> Complete<Self>where Self: Sized,

Transforms Incomplete into Error Read more
source§

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>where C: Display, Self: Sized,

Prints a message and the input if the parser fails. Read more
source§

fn and<G, O2>(self, g: G) -> And<Self, G>where G: Parser<I, O2, E>, Self: Sized,

👎Deprecated since 8.0.0: Replaced with `nom8::sequence::tuple
Applies a second parser after the first one, return their results as a tuple Read more
source§

fn or<G>(self, g: G) -> Or<Self, G>where G: Parser<I, O, E>, Self: Sized,

👎Deprecated since 8.0.0: Replaced with `nom8::branch::alt
Applies a second parser over the input if the first one failed Read more

Auto Trait Implementations§

§

impl<F, O1, O2> RefUnwindSafe for Value<F, O1, O2>where F: RefUnwindSafe, O1: RefUnwindSafe, O2: RefUnwindSafe,

§

impl<F, O1, O2> Send for Value<F, O1, O2>where F: Send, O1: Send, O2: Send,

§

impl<F, O1, O2> Sync for Value<F, O1, O2>where F: Sync, O1: Sync, O2: Sync,

§

impl<F, O1, O2> Unpin for Value<F, O1, O2>where F: Unpin, O1: Unpin, O2: Unpin,

§

impl<F, O1, O2> UnwindSafe for Value<F, O1, O2>where F: UnwindSafe, O1: UnwindSafe, O2: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.