Struct parser_compose::AndThen

source ·
pub struct AndThen<P, F> { /* private fields */ }
Expand description

Trait Implementations§

source§

impl<P: Clone, F: Clone> Clone for AndThen<P, F>

source§

fn clone(&self) -> AndThen<P, F>

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<In, Out, E, P, F, U> Parser<In> for AndThen<P, F>
where P: Parser<In, Out = Out>, F: Fn(P::Out) -> Result<U, E>,

§

type Out = U

The type this parser outputs if successfull
source§

fn try_parse(&self, input: In) -> Option<(Self::Out, In)>

Recognizes a value from the input and returns the result Read more
source§

fn map<F, Mapped>(self, f: F) -> Map<Self, F>
where Self: Sized, F: Fn(Self::Out) -> Mapped,

Returns a parser that applies the function f to its output Read more
source§

fn or<P>(self, next: P) -> Or<Self, P>
where Self: Sized,

Returns a parser that calls the next parser if it fails to match its input. Read more
source§

fn when<F>(self, predicate: F) -> Predicate<Self, F>
where Self: Sized, F: Fn(Self::Out) -> bool,

Returns a parser that only succeeds if pred returns true when given the parser’s output Read more
source§

fn fold<R, Op, Init, IV>( self, count: R, op: Op, init: Init ) -> Fold<Self, Op, Init>
where R: RepetitionArgument, Init: Fn() -> IV, Op: Fn(IV, Self::Out) -> IV, Self: Sized,

Returns a parser that succeeds if it is able to match its input count times. Read more
source§

fn repeats<R>( self, count: R ) -> Fold<Self, RepeatsOperation<Self::Out>, RepeatsInit>
where Self: Sized, R: RepetitionArgument,

Returns a parser that succeeds if it is able to match its input count times, discarding any output along the way Read more
source§

fn accumulate<R>( self, count: R ) -> Fold<Self, AccumulateOperation<Self::Out>, AccumulateInit<Self::Out>>
where R: RepetitionArgument, Self: Sized,

Returns a parser that succeeds if it is able to match its input count times, accumulating output into a Vec along the way. Read more
source§

fn input(self) -> Input<Self>
where Self: Sized,

Returns a parser that outputs the slice of the input that was recognized. Read more
source§

fn optional(self) -> Optional<Self>
where Self: Sized,

Returns a parser always succeeds but wraps the output in an Option. If the original parser would have failed, the parser outputs a Some(None). Read more
source§

fn peek(self) -> Peek<Self>
where Self: Sized,

Returns a parser that never consumes any input regardless of its outcome. It can be used to look ahead. Read more
source§

fn not(self) -> Not<Self>
where Self: Sized,

Returns a parser that succeeds if it was not able to recognize its input and fails if it was able to. It never consumes any input Read more
source§

fn and_then<F, U, E>(self, f: F) -> AndThen<Self, F>
where Self: Sized, F: Fn(Self::Out) -> Result<U, E>,

Returns a parser that applies a falible function f to its output. The parser will return None if f fails. Read more
source§

impl<P: Copy, F: Copy> Copy for AndThen<P, F>

Auto Trait Implementations§

§

impl<P, F> RefUnwindSafe for AndThen<P, F>

§

impl<P, F> Send for AndThen<P, F>
where F: Send, P: Send,

§

impl<P, F> Sync for AndThen<P, F>
where F: Sync, P: Sync,

§

impl<P, F> Unpin for AndThen<P, F>
where F: Unpin, P: Unpin,

§

impl<P, F> UnwindSafe for AndThen<P, F>
where F: UnwindSafe, P: 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> 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,

§

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>,

§

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>,

§

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.