Struct ParserStream

Source
pub struct ParserStream<'input, 'parser, In: ?Sized, Out, Err, P: Parser<In, Out, Err>> { /* private fields */ }
Expand description

A Stream which wraps a Parser and its input.

Calling Stream::next will call the Parser::parse method of the wrapped Parser, with the input that the ParserStream was initialized with.

Implementations§

Source§

impl<'input, 'parser, In: ?Sized, Out, Err, P: Parser<In, Out, Err>> ParserStream<'input, 'parser, In, Out, Err, P>

Source

pub fn new(input: &'input mut In, parser: &'parser mut P) -> Self

Creates a new ParserStream from the provided input and Parser.

Trait Implementations§

Source§

impl<'input, 'parser, In: Debug + ?Sized, Out: Debug, Err: Debug, P: Debug + Parser<In, Out, Err>> Debug for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

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

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

impl<'input, 'parser, In: Hash + ?Sized, Out: Hash, Err: Hash, P: Hash + Parser<In, Out, Err>> Hash for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'input, 'parser, In: Ord + ?Sized, Out: Ord, Err: Ord, P: Ord + Parser<In, Out, Err>> Ord for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

fn cmp( &self, other: &ParserStream<'input, 'parser, In, Out, Err, P>, ) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'input, 'parser, In: PartialEq + ?Sized, Out: PartialEq, Err: PartialEq, P: PartialEq + Parser<In, Out, Err>> PartialEq for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

fn eq(&self, other: &ParserStream<'input, 'parser, In, Out, Err, P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'input, 'parser, In: PartialOrd + ?Sized, Out: PartialOrd, Err: PartialOrd, P: PartialOrd + Parser<In, Out, Err>> PartialOrd for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

fn partial_cmp( &self, other: &ParserStream<'input, 'parser, In, Out, Err, P>, ) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'input, 'parser, In: ?Sized, Out, Err, P: Parser<In, Out, Err>> Stream for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

type Item = Out

The type of the items returned by the Stream if no error occurs.
Source§

type Error = Err

The type of error that may occur while iterating.
Source§

fn next(&mut self) -> Result<Self::Item, Self::Error>

Returns the next item in the stream, or an error if one occurs.
Source§

impl<'input, 'parser, In: Eq + ?Sized, Out: Eq, Err: Eq, P: Eq + Parser<In, Out, Err>> Eq for ParserStream<'input, 'parser, In, Out, Err, P>

Source§

impl<'input, 'parser, In: ?Sized, Out, Err, P: Parser<In, Out, Err>> StructuralPartialEq for ParserStream<'input, 'parser, In, Out, Err, P>

Auto Trait Implementations§

§

impl<'input, 'parser, In, Out, Err, P> Freeze for ParserStream<'input, 'parser, In, Out, Err, P>
where In: ?Sized,

§

impl<'input, 'parser, In, Out, Err, P> RefUnwindSafe for ParserStream<'input, 'parser, In, Out, Err, P>

§

impl<'input, 'parser, In, Out, Err, P> Send for ParserStream<'input, 'parser, In, Out, Err, P>
where In: Send + ?Sized, P: Send, Out: Send, Err: Send,

§

impl<'input, 'parser, In, Out, Err, P> Sync for ParserStream<'input, 'parser, In, Out, Err, P>
where In: Sync + ?Sized, P: Sync, Out: Sync, Err: Sync,

§

impl<'input, 'parser, In, Out, Err, P> Unpin for ParserStream<'input, 'parser, In, Out, Err, P>
where Out: Unpin, Err: Unpin, In: ?Sized,

§

impl<'input, 'parser, In, Out, Err, P> !UnwindSafe for ParserStream<'input, 'parser, In, Out, Err, P>

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.