Skip to main content

FlatUntil

Struct FlatUntil 

Source
pub struct FlatUntil<P, Q> { /* private fields */ }
Expand description

A iterable parser generated from method flat_until.

Implementations§

Source§

impl<P, Q> FlatUntil<P, Q>

Source

pub fn new(inner: P, end: Q) -> Self

Creates a new instance.

Source

pub fn into_inner(self) -> (P, Q)

Extracts the inner parser.

Trait Implementations§

Source§

impl<P: Clone, Q: Clone> Clone for FlatUntil<P, Q>

Source§

fn clone(&self) -> FlatUntil<P, Q>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<P: Debug, Q: Debug> Debug for FlatUntil<P, Q>

Source§

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

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

impl<P, Q, I> IterableParser<I> for FlatUntil<P, Q>
where P: IterableParser<I>, Q: Parser<I>, I: Input + ?Sized,

Source§

type Item = <P as IterableParser<I>>::Item

The type for items of input stream.
Source§

type State = FlatUntilState<I, P, Q>

The internal state used in poll_parse_next. Read more
Source§

fn poll_parse_next( &mut self, input: Pin<&mut I>, cx: &mut Context<'_>, state: &mut Self::State, ) -> PolledResult<Option<Self::Item>, I>

Takes an input, returns a Status of next output or None.
Source§

fn size_hint(&self) -> (usize, Option<usize>)

The estimated size of returned stream.
Source§

impl<P: PartialEq, Q: PartialEq> PartialEq for FlatUntil<P, Q>

Source§

fn eq(&self, other: &FlatUntil<P, Q>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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<P: Eq, Q: Eq> Eq for FlatUntil<P, Q>

Source§

impl<P, Q> StructuralPartialEq for FlatUntil<P, Q>

Auto Trait Implementations§

§

impl<P, Q> Freeze for FlatUntil<P, Q>
where P: Freeze, Q: Freeze,

§

impl<P, Q> RefUnwindSafe for FlatUntil<P, Q>

§

impl<P, Q> Send for FlatUntil<P, Q>
where P: Send, Q: Send,

§

impl<P, Q> Sync for FlatUntil<P, Q>
where P: Sync, Q: Sync,

§

impl<P, Q> Unpin for FlatUntil<P, Q>
where P: Unpin, Q: Unpin,

§

impl<P, Q> UnsafeUnpin for FlatUntil<P, Q>
where P: UnsafeUnpin, Q: UnsafeUnpin,

§

impl<P, Q> UnwindSafe for FlatUntil<P, Q>
where P: UnwindSafe, Q: 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<P, I> IterableParserExt<I> for P
where P: IterableParser<I> + ?Sized, I: Positioned + ?Sized,

Source§

fn parse_iterable<'a, 'b>( &'a mut self, input: &'b mut I, ) -> IterableParserStream<'a, 'b, Self, I, Self::State>
where I: Unpin,

Returns a TryStream by invoking poll_parse_next.
Source§

fn boxed<'a>( self, ) -> Box<dyn IterableParser<I, Item = Self::Item, State = Self::State> + 'a>
where Self: Sized + 'a,

Available on crate feature alloc only.
Wraps the parser into a Box.
Source§

fn no_state(self) -> NoState<Self, Self::State>
where Self: Sized,

Merges State into the parser itself.
Source§

fn left<R>(self) -> Either<Self, R>
where Self: Sized, R: IterableParser<I, Item = Self::Item>,

Wraps the parser into a Either to merge multiple types of parsers.
Source§

fn right<L>(self) -> Either<L, Self>
where Self: Sized, L: IterableParser<I, Item = Self::Item>,

Wraps the parser into a Either to merge multiple types of parsers.
Source§

fn complete(self) -> Skip<Self, Eof<I>>
where Self: Sized,

Parses the input completedly. Read more
Source§

fn chain<P>(self, p: P) -> (Self, P)
where Self: Sized, P: IterableParser<I, Item = Self::Item>,

Chains two iterable parsers and parses items in sequence.
Source§

fn or<P>(self, p: P) -> Or<Self, P>
where I: Input, Self: Sized, P: IterableParser<I, Item = Self::Item>,

Tries another parser if the first parser failed parsing.
Source§

fn opt(self) -> Opt<Self>
where Self: Sized, I: Input,

Returns Some if parsing is succeeded.
Source§

fn skip<P>(self, p: P) -> Skip<Self, P>
where Self: Sized, P: Parser<I>,

Parses with self, then skips p.
Source§

fn between<L, R>(self, left: L, right: R) -> Skip<Prefix<L, Self>, R>
where Self: Sized, L: Parser<I>, R: Parser<I>,

Parses with self between left and right.
Source§

fn discard(self) -> Discard<Self>
where Self: Sized,

Returns a Parser parses all items and returns ().
Source§

fn count(self) -> Count<Self>
where Self: Sized,

Returns a Parser outputs usize by couting up all items.
Source§

fn collect<E: Default + Extend<Self::Item>>(self) -> Collect<Self, E>
where Self: Sized,

Returns a Parser by collecting all the outputs.
Source§

fn first(self) -> Nth<Self>
where Self: Sized,

Consumes all outputs, returns the first element. Read more
Source§

fn last(self) -> Last<Self>
where Self: Sized,

Consumes all outputs, returns the last element. Read more
Source§

fn nth(self, n: usize) -> Nth<Self>
where Self: Sized,

Consumes all outputs, returns the nth element. Read more
Source§

fn fill<const N: usize>(self, start: usize) -> Indices<Self, N>
where Self: Sized,

Consumes all outputs, returns N elements from index start. Read more
Source§

fn indices<const N: usize>(self, ns: [usize; N]) -> Indices<Self, N>
where Self: Sized,

Consumes all outputs, returns multiple elements specified by ns, an ascending ordered array of indices. Read more
Source§

fn flat_repeat<R>(self, range: R) -> FlatRepeat<Self, R>
where Self: Sized, I: Input, R: RangeBounds<usize>,

Repeats the iterable parser like ParserExt::repeat, and flattens into one iterable parser.
Source§

fn flat_times(self, n: usize) -> FlatTimes<Self>
where Self: Sized,

Repeats the iterable parser like ParserExt::times, and flattens into one iterable parser.
Source§

fn flat_sep_by<P, R>(self, sep: P, range: R) -> FlatSepBy<Self, P, R>
where Self: Sized, I: Input, P: Parser<I>, R: RangeBounds<usize>,

Repeats the iterable parser with separaters like ParserExt::sep_by, and flattens into one iterable parser.
Source§

fn flat_sep_by_end<P, R>(self, sep: P, range: R) -> FlatSepByEnd<Self, P, R>
where Self: Sized, I: Input, P: Parser<I>, R: RangeBounds<usize>,

Repeats the iterable parser with separaters like ParserExt::sep_by_end, and flattens into one iterable parser.
Source§

fn flat_sep_by_times<P>(self, sep: P, count: usize) -> FlatSepByTimes<Self, P>
where Self: Sized, P: Parser<I>,

Repeats the iterable parser with separaters like ParserExt::sep_by_times, and flattens into one iterable parser.
Source§

fn flat_sep_by_end_times<P>( self, sep: P, count: usize, ) -> FlatSepByEndTimes<Self, P>
where Self: Sized, I: Input, P: Parser<I>,

Repeats the iterable parser with separaters like ParserExt::sep_by_end_times, and flattens into one iterable parser.
Source§

fn flat_until<P>(self, end: P) -> FlatUntil<Self, P>
where Self: Sized, I: Input, P: Parser<I>,

Repeats the iterable parser until end like ParserExt::until, and flattens into one iterable parser.
Source§

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

Converts an output value into another type.
Source§

fn try_map<F, O, E>(self, f: F) -> TryMap<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> Result<O, E>, E: Into<Expects>,

Converts an output value into another type.
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Returns current iteration count with elements. Read more
Source§

fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: IntoIterator,

Flattens iteratable items.
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where Self: Sized, F: FnMut(&Self::Item) -> bool,

Only returns items matches the condition.
Source§

fn fold<Q, F>(self, init: Q, f: F) -> Fold<Self, Q, F>
where Self: Sized, Q: Parser<I>, F: FnMut(Q::Output, Self::Item) -> Q::Output,

Folds items into an accumulator by repeatedly applying a function.
Source§

fn try_fold<Q, F, E>(self, init: Q, f: F) -> TryFold<Self, Q, F>
where Self: Sized, Q: Parser<I>, F: FnMut(Q::Output, Self::Item) -> Result<Q::Output, E>, E: Into<Expects>,

Tries to fold items into an accumulator by repeatedly applying a failable function.
Source§

fn reduce<F>(self, f: F) -> Reduce<Self, F>
where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces items into a item by repeatedly applying a function.
Source§

fn try_reduce<F, E>(self, f: F) -> TryReduce<Self, F>
where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, E>, E: Into<Expects>,

Tries to reduce items into a item by repeatedly applying a failable function.
Source§

fn scan<Q, F, T>(self, init: Q, f: F) -> Scan<Self, Q, F>
where Self: Sized, Q: Parser<I>, F: FnMut(&mut Q::Output, Self::Item) -> Option<T>,

Holds internal state, applies the function item by item and returns the output (if it is Some).
Source§

fn try_scan<Q, F, T, E>(self, init: Q, f: F) -> TryScan<Self, Q, F>
where Self: Sized, Q: Parser<I>, F: FnMut(&mut Q::Output, Self::Item) -> Result<Option<T>, E>, E: Into<Expects>,

Holds internal state, applies the failable function item by item and tries to return the output (if it is Some).
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.