pub trait IterableParserExt<I: Positioned + ?Sized>: IterableParser<I> {
Show 37 methods
// Provided methods
fn parse_iterable<'a, 'b>(
&'a mut self,
input: &'b mut I,
) -> IterableParserStream<'a, 'b, Self, I, Self::State>
where I: Unpin { ... }
fn boxed<'a>(
self,
) -> Box<dyn IterableParser<I, Item = Self::Item, State = Self::State> + 'a>
where Self: Sized + 'a { ... }
fn no_state(self) -> NoState<Self, Self::State>
where Self: Sized { ... }
fn left<R>(self) -> Either<Self, R> ⓘ
where Self: Sized,
R: IterableParser<I, Item = Self::Item> { ... }
fn right<L>(self) -> Either<L, Self> ⓘ
where Self: Sized,
L: IterableParser<I, Item = Self::Item> { ... }
fn complete(self) -> Skip<Self, Eof<I>> ⓘ
where Self: Sized { ... }
fn chain<P>(self, p: P) -> (Self, P) ⓘ
where Self: Sized,
P: IterableParser<I, Item = Self::Item> { ... }
fn or<P>(self, p: P) -> Or<Self, P> ⓘ
where I: Input,
Self: Sized,
P: IterableParser<I, Item = Self::Item> { ... }
fn opt(self) -> Opt<Self> ⓘ
where Self: Sized,
I: Input { ... }
fn skip<P>(self, p: P) -> Skip<Self, P> ⓘ
where Self: Sized,
P: Parser<I> { ... }
fn between<L, R>(self, left: L, right: R) -> Skip<Prefix<L, Self>, R> ⓘ
where Self: Sized,
L: Parser<I>,
R: Parser<I> { ... }
fn discard(self) -> Discard<Self> ⓘ
where Self: Sized { ... }
fn count(self) -> Count<Self> ⓘ
where Self: Sized { ... }
fn collect<E: Default + Extend<Self::Item>>(self) -> Collect<Self, E> ⓘ
where Self: Sized { ... }
fn first(self) -> Nth<Self> ⓘ
where Self: Sized { ... }
fn last(self) -> Last<Self> ⓘ
where Self: Sized { ... }
fn nth(self, n: usize) -> Nth<Self> ⓘ
where Self: Sized { ... }
fn fill<const N: usize>(self, start: usize) -> Indices<Self, N> ⓘ
where Self: Sized { ... }
fn indices<const N: usize>(self, ns: [usize; N]) -> Indices<Self, N> ⓘ
where Self: Sized { ... }
fn flat_repeat<R>(self, range: R) -> FlatRepeat<Self, R> ⓘ
where Self: Sized,
I: Input,
R: RangeBounds<usize> { ... }
fn flat_times(self, n: usize) -> FlatTimes<Self> ⓘ
where Self: Sized { ... }
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> { ... }
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> { ... }
fn flat_sep_by_times<P>(
self,
sep: P,
count: usize,
) -> FlatSepByTimes<Self, P> ⓘ
where Self: Sized,
P: Parser<I> { ... }
fn flat_sep_by_end_times<P>(
self,
sep: P,
count: usize,
) -> FlatSepByEndTimes<Self, P> ⓘ
where Self: Sized,
I: Input,
P: Parser<I> { ... }
fn flat_until<P>(self, end: P) -> FlatUntil<Self, P> ⓘ
where Self: Sized,
I: Input,
P: Parser<I> { ... }
fn map<F, O>(self, f: F) -> Map<Self, F> ⓘ
where Self: Sized,
F: FnMut(Self::Item) -> O { ... }
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> { ... }
fn enumerate(self) -> Enumerate<Self> ⓘ
where Self: Sized { ... }
fn flatten(self) -> Flatten<Self> ⓘ
where Self: Sized,
Self::Item: IntoIterator { ... }
fn filter<F>(self, f: F) -> Filter<Self, F> ⓘ
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
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 { ... }
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> { ... }
fn reduce<F>(self, f: F) -> Reduce<Self, F> ⓘ
where Self: Sized,
F: FnMut(Self::Item, Self::Item) -> Self::Item { ... }
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> { ... }
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> { ... }
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> { ... }
}Provided Methods§
Sourcefn parse_iterable<'a, 'b>(
&'a mut self,
input: &'b mut I,
) -> IterableParserStream<'a, 'b, Self, I, Self::State>where
I: Unpin,
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.
Sourcefn boxed<'a>(
self,
) -> Box<dyn IterableParser<I, Item = Self::Item, State = Self::State> + 'a>where
Self: Sized + 'a,
Available on crate feature alloc only.
fn boxed<'a>(
self,
) -> Box<dyn IterableParser<I, Item = Self::Item, State = Self::State> + 'a>where
Self: Sized + 'a,
alloc only.Wraps the parser into a Box.
Sourcefn no_state(self) -> NoState<Self, Self::State>where
Self: Sized,
fn no_state(self) -> NoState<Self, Self::State>where
Self: Sized,
Merges State into the parser itself.
Sourcefn left<R>(self) -> Either<Self, R> ⓘ
fn left<R>(self) -> Either<Self, R> ⓘ
Wraps the parser into a Either to merge multiple types of parsers.
Sourcefn right<L>(self) -> Either<L, Self> ⓘ
fn right<L>(self) -> Either<L, Self> ⓘ
Wraps the parser into a Either to merge multiple types of parsers.
Sourcefn complete(self) -> Skip<Self, Eof<I>> ⓘwhere
Self: Sized,
fn complete(self) -> Skip<Self, Eof<I>> ⓘwhere
Self: Sized,
Parses the input completedly.
This method is a conventional method, and equivalent to self.skip(eof()).
Sourcefn chain<P>(self, p: P) -> (Self, P) ⓘ
fn chain<P>(self, p: P) -> (Self, P) ⓘ
Chains two iterable parsers and parses items in sequence.
Sourcefn between<L, R>(self, left: L, right: R) -> Skip<Prefix<L, Self>, R> ⓘ
fn between<L, R>(self, left: L, right: R) -> Skip<Prefix<L, Self>, R> ⓘ
Parses with self between left and right.
Sourcefn discard(self) -> Discard<Self> ⓘwhere
Self: Sized,
fn discard(self) -> Discard<Self> ⓘwhere
Self: Sized,
Returns a Parser parses all items and returns ().
Sourcefn collect<E: Default + Extend<Self::Item>>(self) -> Collect<Self, E> ⓘwhere
Self: Sized,
fn collect<E: Default + Extend<Self::Item>>(self) -> Collect<Self, E> ⓘwhere
Self: Sized,
Returns a Parser by collecting all the outputs.
Sourcefn first(self) -> Nth<Self> ⓘwhere
Self: Sized,
fn first(self) -> Nth<Self> ⓘwhere
Self: Sized,
Consumes all outputs, returns the first element.
This method is equivalent to self.nth(0), and if the stream is empty, it returns None.
Sourcefn last(self) -> Last<Self> ⓘwhere
Self: Sized,
fn last(self) -> Last<Self> ⓘwhere
Self: Sized,
Consumes all outputs, returns the last element.
If the stream is empty, it returns None.
Sourcefn nth(self, n: usize) -> Nth<Self> ⓘwhere
Self: Sized,
fn nth(self, n: usize) -> Nth<Self> ⓘwhere
Self: Sized,
Consumes all outputs, returns the nth element.
Note that n starts from 0 and if the length of stream less than n, it returns None.
Sourcefn fill<const N: usize>(self, start: usize) -> Indices<Self, N> ⓘwhere
Self: Sized,
fn fill<const N: usize>(self, start: usize) -> Indices<Self, N> ⓘwhere
Self: Sized,
Consumes all outputs, returns N elements from index start.
This method is equivalent to self.indexes([start, start+1, ... , start+N-1]).
Sourcefn indices<const N: usize>(self, ns: [usize; N]) -> Indices<Self, N> ⓘwhere
Self: Sized,
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.
Note that n starts from 0 and if the length of stream less than n, it returns None.
§Panics
if ns is not ascending ordered.
Sourcefn flat_repeat<R>(self, range: R) -> FlatRepeat<Self, R> ⓘ
fn flat_repeat<R>(self, range: R) -> FlatRepeat<Self, R> ⓘ
Repeats the iterable parser like ParserExt::repeat, and flattens into one iterable
parser.
Sourcefn flat_times(self, n: usize) -> FlatTimes<Self> ⓘwhere
Self: Sized,
fn flat_times(self, n: usize) -> FlatTimes<Self> ⓘwhere
Self: Sized,
Repeats the iterable parser like ParserExt::times, and flattens into one iterable
parser.
Sourcefn flat_sep_by<P, R>(self, sep: P, range: R) -> FlatSepBy<Self, P, R> ⓘ
fn flat_sep_by<P, R>(self, sep: P, range: R) -> FlatSepBy<Self, P, R> ⓘ
Repeats the iterable parser with separaters like ParserExt::sep_by, and flattens into one
iterable parser.
Sourcefn flat_sep_by_end<P, R>(self, sep: P, range: R) -> FlatSepByEnd<Self, P, R> ⓘ
fn flat_sep_by_end<P, R>(self, sep: P, range: R) -> FlatSepByEnd<Self, P, R> ⓘ
Repeats the iterable parser with separaters like ParserExt::sep_by_end, and flattens
into one iterable parser.
Sourcefn flat_sep_by_times<P>(self, sep: P, count: usize) -> FlatSepByTimes<Self, P> ⓘ
fn flat_sep_by_times<P>(self, sep: P, count: usize) -> FlatSepByTimes<Self, P> ⓘ
Repeats the iterable parser with separaters like ParserExt::sep_by_times, and flattens
into one iterable parser.
Sourcefn flat_sep_by_end_times<P>(
self,
sep: P,
count: usize,
) -> FlatSepByEndTimes<Self, P> ⓘ
fn flat_sep_by_end_times<P>( self, sep: P, count: usize, ) -> FlatSepByEndTimes<Self, P> ⓘ
Repeats the iterable parser with separaters like ParserExt::sep_by_end_times, and
flattens into one iterable parser.
Sourcefn flat_until<P>(self, end: P) -> FlatUntil<Self, P> ⓘ
fn flat_until<P>(self, end: P) -> FlatUntil<Self, P> ⓘ
Repeats the iterable parser until end like ParserExt::until, and flattens into one
iterable parser.
Sourcefn try_map<F, O, E>(self, f: F) -> TryMap<Self, F> ⓘ
fn try_map<F, O, E>(self, f: F) -> TryMap<Self, F> ⓘ
Converts an output value into another type.
Sourcefn enumerate(self) -> Enumerate<Self> ⓘwhere
Self: Sized,
fn enumerate(self) -> Enumerate<Self> ⓘwhere
Self: Sized,
Returns current iteration count with elements.
The returned parser’s item will be (usize, Self::Item).
Sourcefn fold<Q, F>(self, init: Q, f: F) -> Fold<Self, Q, F> ⓘ
fn fold<Q, F>(self, init: Q, f: F) -> Fold<Self, Q, F> ⓘ
Folds items into an accumulator by repeatedly applying a function.
Sourcefn try_fold<Q, F, E>(self, init: Q, f: F) -> TryFold<Self, Q, F> ⓘ
fn try_fold<Q, F, E>(self, init: Q, f: F) -> TryFold<Self, Q, F> ⓘ
Tries to fold items into an accumulator by repeatedly applying a failable function.
Sourcefn reduce<F>(self, f: F) -> Reduce<Self, F> ⓘ
fn reduce<F>(self, f: F) -> Reduce<Self, F> ⓘ
Reduces items into a item by repeatedly applying a function.
Sourcefn try_reduce<F, E>(self, f: F) -> TryReduce<Self, F> ⓘ
fn try_reduce<F, E>(self, f: F) -> TryReduce<Self, F> ⓘ
Tries to reduce items into a item by repeatedly applying a failable function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".