Trait combine::StreamOnce
[−]
[src]
pub trait StreamOnce { type Item: Clone + PartialEq; type Range: Clone + PartialEq; type Position: Ord; fn uncons(&mut self) -> Result<Self::Item, Error<Self::Item, Self::Range>>; fn position(&self) -> Self::Position; }
StreamOnce
represents a sequence of items that can be extracted one by one.
Associated Types
type Item: Clone + PartialEq
The type of items which is yielded from this stream.
type Range: Clone + PartialEq
The type of a range of items yielded from this stream.
Types which do not a have a way of yielding ranges of items should just use the
Self::Item
for this type.
type Position: Ord
Type which represents the position in a stream.
Ord
is required to allow parsers to determine which of two positions are further ahead.
Required Methods
fn uncons(&mut self) -> Result<Self::Item, Error<Self::Item, Self::Range>>
Takes a stream and removes its first item, yielding the item and the rest of the elements.
Returns Err
if no element could be retrieved.
fn position(&self) -> Self::Position
Returns the current position of the stream.
Implementations on Foreign Types
impl<'a> StreamOnce for &'a str
[src]
impl<'a> StreamOnce for &'a str
impl<'a, T> StreamOnce for &'a [T] where
T: Clone + PartialEq,
[src]
impl<'a, T> StreamOnce for &'a [T] where
T: Clone + PartialEq,
Implementors
impl<I> StreamOnce for State<I> where
I: Stream,
I::Item: Positioner, type Item = I::Item; type Range = I::Range; type Position = <I::Item as Positioner>::Position;impl<'a, T> StreamOnce for SliceStream<'a, T> where
T: Clone + PartialEq + 'a, type Item = &'a T; type Range = &'a [T]; type Position = usize;impl<I: Iterator> StreamOnce for IteratorStream<I> where
I::Item: Clone + PartialEq, type Item = I::Item; type Range = I::Item; type Position = usize;impl<R: Read> StreamOnce for ReadStream<R> type Item = u8; type Range = u8; type Position = usize;
impl<'a, I> StreamOnce for BufferedStream<'a, I> where
I: StreamOnce + 'a,
I::Position: Clone,
I::Item: Clone + PartialEq + 'a, type Item = I::Item; type Range = I::Range; type Position = I::Position;