Struct ParserMap

Source
pub struct ParserMap<P, I: ?Sized, M, E, F> {
    pub parser: P,
    pub func: F,
    pub phantom_i: PhantomData<I>,
    pub phantom_e: PhantomData<E>,
    pub phantom_m: PhantomData<M>,
}

Fields§

§parser: P§func: F§phantom_i: PhantomData<I>§phantom_e: PhantomData<E>§phantom_m: PhantomData<M>

Trait Implementations§

Source§

impl<'a, P, M, I, O, E: ParserError, PType, F> Parser<'a, I, O, E, ParserMapT<PType, M>> for ParserMap<P, I, M, E, F>
where P: Parser<'a, I, M, E, PType>, F: Fn(M) -> O, I: ?Sized + Sequence,

Source§

fn fab(&self, input: &mut &'a I) -> Result<O, E>

Parses the input. This method advances the input reference to the remaining unparsed input. The method is named “fab” instead of “parse” to avoid conflicts with the “parse” method of &str.
Source§

fn fab_value<V: Clone>(self, value: V) -> Value<Self, V, I, O, E>
where Self: Sized,

Returns a parser that replaces the output of the underlying parser with V.
Source§

fn fab_map<F>(self, func: F) -> ParserMap<Self, I, O, E, F>
where Self: Sized,

This creates a Map parser that applies the function to the output of the underlying parser.
Source§

fn fab_try_map<F>(self, func: F) -> ParserTryMap<Self, I, O, E, F>
where Self: Sized,

This parser first maps the input, and if the result is Option::Some or Result::Ok, it unwraps the input. Othewise, the parser fails.
Source§

fn fab_repeat(self) -> Repeat<Self, I, O, E, fn(&mut Vec<O>, O), Vec<O>>
where Self: Sized, O: Clone,

Repeats the underlying parser, returning the results in a Vec. This parser will accept any number of repetitions, including 0. Read more

Auto Trait Implementations§

§

impl<P, I, M, E, F> Freeze for ParserMap<P, I, M, E, F>
where P: Freeze, F: Freeze, I: ?Sized,

§

impl<P, I, M, E, F> RefUnwindSafe for ParserMap<P, I, M, E, F>

§

impl<P, I, M, E, F> Send for ParserMap<P, I, M, E, F>
where P: Send, F: Send, I: Send + ?Sized, E: Send, M: Send,

§

impl<P, I, M, E, F> Sync for ParserMap<P, I, M, E, F>
where P: Sync, F: Sync, I: Sync + ?Sized, E: Sync, M: Sync,

§

impl<P, I, M, E, F> Unpin for ParserMap<P, I, M, E, F>
where P: Unpin, F: Unpin, I: Unpin + ?Sized, E: Unpin, M: Unpin,

§

impl<P, I, M, E, F> UnwindSafe for ParserMap<P, I, M, E, F>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.