[−][src]Trait combine::RangeStreamOnce
A RangeStream
is an extension of StreamOnce
which allows for zero copy parsing.
Required methods
fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
&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
.
fn uncons_while<F>(&mut self, f: F) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
F: FnMut(Self::Item) -> bool,
Takes items from stream, testing each one with predicate
.
returns the range of items which passed predicate
.
fn distance(&self, end: &Self::Checkpoint) -> usize
Returns the distance between self
and end
. The returned usize
must be so that
ⓘThis example is not tested
let start = stream.checkpoint(); stream.uncons_range(distance); stream.distance(&start) == distance
Provided methods
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> 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 EmptyOk
as it should uncons at least one item.
Implementations on Foreign Types
impl<'a> RangeStreamOnce for &'a str
[src]
fn uncons_while<F>(&mut self, f: F) -> Result<&'a str, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
fn uncons_range(&mut self, size: usize) -> Result<&'a str, StreamErrorFor<Self>>
[src]
fn distance(&self, end: &Self) -> usize
[src]
impl<'a, T> RangeStreamOnce for &'a [T] where
T: Clone + PartialEq,
[src]
T: Clone + PartialEq,
fn uncons_range(&mut self, size: usize) -> Result<&'a [T], StreamErrorFor<Self>>
[src]
fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
fn distance(&self, end: &Self) -> usize
[src]
Implementors
impl<'a, T> RangeStreamOnce for SliceStream<'a, T> where
T: PartialEq + 'a,
[src]
T: PartialEq + 'a,
fn uncons_range(&mut self, size: usize) -> Result<&'a [T], StreamErrorFor<Self>>
[src]
fn uncons_while<F>(&mut self, f: F) -> Result<&'a [T], StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
fn distance(&self, end: &Self) -> usize
[src]
impl<I, X, S> RangeStreamOnce for State<I, X> where
I: RangeStreamOnce,
X: Resetable + RangePositioner<I::Item, I::Range>,
S: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = S>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = S>,
I::Position: Clone + Ord,
[src]
I: RangeStreamOnce,
X: Resetable + RangePositioner<I::Item, I::Range>,
S: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = S>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = S>,
I::Position: Clone + Ord,
fn uncons_range(
&mut self,
size: usize
) -> Result<I::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<I::Range, StreamErrorFor<Self>>
fn uncons_while<F>(
&mut self,
predicate: F
) -> Result<I::Range, StreamErrorFor<Self>> where
F: FnMut(I::Item) -> bool,
[src]
&mut self,
predicate: F
) -> Result<I::Range, StreamErrorFor<Self>> where
F: FnMut(I::Item) -> bool,
fn uncons_while1<F>(
&mut self,
predicate: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
predicate: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
impl<S> RangeStreamOnce for Stream<S> where
S: RangeStream,
[src]
S: RangeStream,
fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
fn uncons_while<F>(&mut self, f: F) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
fn distance(&self, end: &Self::Checkpoint) -> usize
[src]
impl<S> RangeStreamOnce for PartialStream<S> where
S: RangeStreamOnce,
[src]
S: RangeStreamOnce,
fn uncons_range(
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
[src]
&mut self,
size: usize
) -> Result<Self::Range, StreamErrorFor<Self>>
fn uncons_while<F>(&mut self, f: F) -> Result<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
F: FnMut(Self::Item) -> bool,
fn uncons_while1<F>(
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,
[src]
&mut self,
f: F
) -> FastResult<Self::Range, StreamErrorFor<Self>> where
F: FnMut(Self::Item) -> bool,