Struct TokenParser

Source
pub struct TokenParser<F>(/* private fields */);

Implementations§

Source§

impl<F> TokenParser<F>

Source

pub fn new(function: F) -> Self

Trait Implementations§

Source§

impl<F> Clone for TokenParser<F>
where F: Copy,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug> Debug for TokenParser<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F> Parser for TokenParser<F>

Source§

fn or_else<P>(self, other: P) -> OrElseParser<Self, P>
where Self: Sized,

Choice between parsers (returns a parser).
Source§

fn or_emit<F>(self, factory: F) -> OrEmitParser<Self, F>
where Self: Sized,

Gives a parser a default value (returns a committed parser).
Source§

fn and_then<P>(self, other: P) -> AndThenParser<Self, P>
where Self: Sized,

Sequencing with a committed parser (returns a committed parser).
Source§

fn try_and_then<P>(self, other: P) -> MapParser<AndThenParser<Self, P>, TryZip>
where Self: Sized,

Sequencing with a committed parser (returns a committed parser which produces an error when this parser returns an error).
Source§

fn and_then_try<P>(self, other: P) -> MapParser<AndThenParser<Self, P>, ZipTry>
where Self: Sized,

Sequencing with a committed parser (returns a committed parser which produces an error when the other parser returns an error).
Source§

fn try_and_then_try<P>( self, other: P, ) -> MapParser<AndThenParser<Self, P>, TryZipTry>
where Self: Sized,

Sequencing with a committed parser (returns a committed parser which produces an error when the other parser returns an error).
Source§

fn plus<F>(self, factory: F) -> PlusParser<Self, F>
where Self: Sized,

Iterate one or more times (returns a parser).
Source§

fn star<F>(self, factory: F) -> StarParser<Self, F>
where Self: Sized,

Iterate zero or more times (returns a committed parser).
Source§

fn map<F>(self, f: F) -> MapParser<Self, F>
where Self: Sized,

Apply a function to the result (returns a committed parser).
Source§

fn map2<F>(self, f: F) -> MapParser<Self, Function2<F>>
where Self: Sized,

Apply a 2-arguent function to the result (returns a committed parser).
Source§

fn map3<F>(self, f: F) -> MapParser<Self, Function3<F>>
where Self: Sized,

Apply a 3-arguent function to the result (returns a committed parser).
Source§

fn map4<F>(self, f: F) -> MapParser<Self, Function4<F>>
where Self: Sized,

Apply a 4-arguent function to the result (returns a committed parser).
Source§

fn map5<F>(self, f: F) -> MapParser<Self, Function5<F>>
where Self: Sized,

Apply a 5-arguent function to the result (returns a committed parser).
Source§

fn try_map<F>(self, f: F) -> MapParser<Self, Try<F>>
where Self: Sized,

Apply a function to the result (returns a committed parser which produces an error when this parser returns an error).
Source§

fn try_map2<F>(self, f: F) -> MapParser<Self, Try<Function2<F>>>
where Self: Sized,

Apply a 2-argument function to the result (returns a committed parser which produces an error when this parser returns an error).
Source§

fn try_map3<F>(self, f: F) -> MapParser<Self, Try<Function3<F>>>
where Self: Sized,

Apply a 3-argument function to the result (returns a committed parser which produces an error when this parser returns an error).
Source§

fn try_map4<F>(self, f: F) -> MapParser<Self, Try<Function4<F>>>
where Self: Sized,

Apply a 4-argument function to the result (returns a committed parser which produces an error when this parser returns an error).
Source§

fn try_map5<F>(self, f: F) -> MapParser<Self, Try<Function5<F>>>
where Self: Sized,

Apply a 5-argument function to the result (returns a committed parser which produces an error when this parser returns an error).
Source§

fn pipe<P>(self, other: P) -> PipeParser<Self, P>
where Self: Sized,

Take the results of iterating this parser, and feed it into another parser.
Source§

fn buffer(self) -> BufferedParser<Self>
where Self: Sized,

A parser which produces its input. Read more
Source§

impl<F, I> Uncommitted<Peekable<I>> for TokenParser<F>
where F: for<'a> Function<&'a I::Item, Output = bool>, I: Iterator,

Source§

type Output = <I as Iterator>::Item

The type of the data being produced by the parser.
Source§

type State = ImpossibleStatefulParser<<I as Iterator>::Item>

The type of the parser state.
Source§

fn parse( &self, iterator: Peekable<I>, ) -> MaybeParseResult<Self::State, Peekable<I>>

Provides data to the parser. Read more
Source§

impl<F> Copy for TokenParser<F>
where F: Copy,

Auto Trait Implementations§

§

impl<F> Freeze for TokenParser<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for TokenParser<F>
where F: RefUnwindSafe,

§

impl<F> Send for TokenParser<F>
where F: Send,

§

impl<F> Sync for TokenParser<F>
where F: Sync,

§

impl<F> Unpin for TokenParser<F>
where F: Unpin,

§

impl<F> UnwindSafe for TokenParser<F>
where F: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.