Struct Collect

Source
pub struct Collect<P, V>(/* private fields */)
where
    P: ParserIteratorBase,
    V: FromIterator<P::Element>;

Trait Implementations§

Source§

impl<S, P, V> Parser<S> for Collect<P, V>
where S: Stream<Item = P::Input> + ?Sized, P: ParserIterator<S>, V: FromIterator<P::Element>,

Source§

fn parse_lookahead( &self, stream: &mut S, ) -> ParseResult<Option<(Self::Output, Consume)>>

Source§

fn parse(&self, stream: &mut S) -> ParseResult<Self::Output>

Source§

fn parse_consume(&self, stream: &mut S) -> ParseResult<(Self::Output, Consume)>

Source§

impl<P, V> ParserBase for Collect<P, V>

Source§

type Input = <P as ParserIteratorBase>::Input

The input type of the parser. u8 for byte-eating parsers.
Source§

type Output = V

The output type which this monadic parser produces.
Source§

fn emptiable() -> bool

Whether the parser “usually” accepts the empty sequence. Only used in emit_expectations.
Source§

fn map_once<O, F>(self, f: F) -> Map<O, Self, F>
where Self: Sized, F: FnOnce(Self::Output) -> O,

Converts a semantic value after parsing. Similar to ParserBase::map, but accepts FnOnce closures.
Source§

fn map_mut<O, F>(self, f: F) -> Map<O, Self, F>
where Self: Sized, F: FnMut(Self::Output) -> O,

Converts a semantic value after parsing. Similar to ParserBase::map, but accepts FnMut closures.
Source§

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

Converts a semantic value after parsing.
Source§

fn and_then_once<P, F>(self, f: F) -> AndThen<Self, P, F>
where Self: Sized, P: ParserBase<Input = Self::Input>, F: FnOnce(Self::Output) -> P,

Monadic operator: run another parser f(x) after parsing. Similar to ParserBase::and_then, but accepts FnOnce closures.
Source§

fn and_then_mut<P, F>(self, f: F) -> AndThen<Self, P, F>
where Self: Sized, P: ParserBase<Input = Self::Input>, F: FnMut(Self::Output) -> P,

Monadic operator: run another parser f(x) after parsing. Similar to ParserBase::and_then, but accepts FnMut closures.
Source§

fn and_then<P, F>(self, f: F) -> AndThen<Self, P, F>
where Self: Sized, P: ParserBase<Input = Self::Input>, F: Fn(Self::Output) -> P,

Monadic operator: run another parser f(x) after parsing. Read more
Source§

fn concat<P>(self, p: P) -> Concat2<Self, P>
where Self: Sized, P: ParserBase<Input = Self::Input>,

Applicative operator: run another parser p after parsing. The result is a pair of the result of the parsers.
Source§

fn or<P>(self, p: P) -> Choice2<Self, P>
where Self: Sized, P: ParserBase<Input = Self::Input, Output = Self::Output>,

If the parser failed without consumption, try another parser.
Source§

fn many1(self) -> Many1<Self>
where Self: Sized,

Returns a ParserIteratorBase that collects one or more objects from this parser.
Source§

impl<S, P, V> ParserMut<S> for Collect<P, V>
where S: Stream<Item = P::Input> + ?Sized, P: ParserIteratorMut<S>, V: FromIterator<P::Element>,

Source§

fn parse_lookahead_mut( &mut self, stream: &mut S, ) -> ParseResult<Option<(Self::Output, Consume)>>

Source§

fn parse_mut(&mut self, stream: &mut S) -> ParseResult<Self::Output>

Source§

fn parse_consume_mut( &mut self, stream: &mut S, ) -> ParseResult<(Self::Output, Consume)>

Source§

impl<S, P, V> ParserOnce<S> for Collect<P, V>
where S: Stream<Item = P::Input> + ?Sized, P: ParserIteratorMut<S>, V: FromIterator<P::Element>,

Auto Trait Implementations§

§

impl<P, V> Freeze for Collect<P, V>
where P: Freeze,

§

impl<P, V> RefUnwindSafe for Collect<P, V>
where P: RefUnwindSafe,

§

impl<P, V> Send for Collect<P, V>
where P: Send,

§

impl<P, V> Sync for Collect<P, V>
where P: Sync,

§

impl<P, V> Unpin for Collect<P, V>
where P: Unpin,

§

impl<P, V> UnwindSafe for Collect<P, V>
where 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, 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.