Trait combine::RangeStreamOnce [] [src]

pub trait RangeStreamOnce: StreamOnce + Resetable {
    fn uncons_range(
        &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
;
fn distance(&self, end: &Self::Checkpoint) -> usize; }

A RangeStream is an extension of StreamOnce which allows for zero copy parsing.

Required Methods

Takes size elements from the stream. Fails if the length of the stream is less than size.

Takes items from stream, testing each one with predicate. returns the range of items which passed predicate.

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

Implementations on Foreign Types

impl<'a> RangeStreamOnce for &'a str
[src]

[src]

[src]

[src]

impl<'a, T> RangeStreamOnce for &'a [T] where
    T: Clone + PartialEq
[src]

[src]

[src]

[src]

Implementors