[−][src]Trait combine::RangeStreamOnce
A RangeStream
is an extension of StreamOnce
which allows for zero copy parsing.
Required methods
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
Takes size
elements from the stream.
Fails if the length of the stream is less than size
.
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
Takes items from stream, testing each one with predicate
.
returns the range of items which passed predicate
.
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
Returns the distance between self
and end
. The returned usize
must be so that
ⓘ
let start = stream.checkpoint(); stream.uncons_range(distance); stream.distance(&start) == distance
pub fn range(&self) -> Self::Range
[src]
Returns the entire range of self
Provided methods
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
Takes items from stream, testing each one with predicate
returns a range of at least one items which passed predicate
.
Note
This may not return PeekOk
as it should uncons at least one token.
Implementations on Foreign Types
impl<'a, I: ?Sized> RangeStreamOnce for &'a mut I where
I: RangeStreamOnce,
[src]
I: RangeStreamOnce,
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<'a> RangeStreamOnce for &'a str
[src]
pub fn uncons_while<F>(&mut self, f: F) -> Result<&'a str, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<&'a str, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<&'a str, StreamErrorFor<Self>>
pub fn distance(&self, end: &Self) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<'a, T> RangeStreamOnce for &'a [T] where
T: Clone + PartialEq,
[src]
T: Clone + PartialEq,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<&'a [T], StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<&'a [T], StreamErrorFor<Self>>
pub fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
Implementors
impl<'a, T> RangeStreamOnce for SliceStream<'a, T> where
T: PartialEq + 'a,
[src]
T: PartialEq + 'a,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<&'a [T], StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<&'a [T], StreamErrorFor<Self>>
pub fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<Input, X, S> RangeStreamOnce for combine::stream::position::Stream<Input, X> where
Input: RangeStreamOnce,
X: RangePositioner<Input::Token, Input::Range>,
S: StreamError<Input::Token, Input::Range>,
Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S>,
Input::Error: ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>,
Input::Position: Clone + Ord,
[src]
Input: RangeStreamOnce,
X: RangePositioner<Input::Token, Input::Range>,
S: StreamError<Input::Token, Input::Range>,
Input::Error: ParseError<Input::Token, Input::Range, X::Position, StreamError = S>,
Input::Error: ParseError<Input::Token, Input::Range, Input::Position, StreamError = S>,
Input::Position: Clone + Ord,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Input::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Input::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
predicate: F
) -> Result<Input::Range, StreamErrorFor<Self>> where
F: FnMut(Input::Token) -> bool,
[src]
&mut self,
predicate: F
) -> Result<Input::Range, StreamErrorFor<Self>> where
F: FnMut(Input::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
predicate: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
predicate: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S> RangeStreamOnce for combine::stream::easy::Stream<S> where
S: RangeStream,
S::Token: PartialEq,
S::Range: PartialEq,
[src]
S: RangeStream,
S::Token: PartialEq,
S::Range: PartialEq,
This is supported on crate feature
std
only.pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S> RangeStreamOnce for CompleteStream<S> where
S: RangeStreamOnce,
[src]
S: RangeStreamOnce,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S> RangeStreamOnce for MaybePartialStream<S> where
S: RangeStreamOnce,
[src]
S: RangeStreamOnce,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S> RangeStreamOnce for PartialStream<S> where
S: RangeStreamOnce,
[src]
S: RangeStreamOnce,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S, E> RangeStreamOnce for combine::stream::span::Stream<S, E> where
S: RangeStream,
S::Token: PartialEq,
S::Range: PartialEq,
E: ParseError<S::Token, S::Range, Span<S::Position>>,
S::Error: ParseErrorInto<S::Token, S::Range, S::Position>,
<S::Error as ParseError<S::Token, S::Range, S::Position>>::StreamError: StreamErrorInto<S::Token, S::Range>,
[src]
S: RangeStream,
S::Token: PartialEq,
S::Range: PartialEq,
E: ParseError<S::Token, S::Range, Span<S::Position>>,
S::Error: ParseErrorInto<S::Token, S::Range, S::Position>,
<S::Error as ParseError<S::Token, S::Range, S::Position>>::StreamError: StreamErrorInto<S::Token, S::Range>,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
pub fn range(&self) -> Self::Range
[src]
impl<S, U> RangeStreamOnce for combine::stream::state::Stream<S, U> where
S: RangeStreamOnce,
[src]
S: RangeStreamOnce,
pub fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
pub fn uncons_while<F>(
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
pub fn uncons_while1<F>(
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,
[src]
&mut self,
f: F
) -> ParseResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Token) -> bool,