Struct combine::primitives::State
[−]
[src]
pub struct State<I> where I: Stream, I::Item: Positioner { pub position: I::Item::Position, pub input: I, }
The State<I>
struct keeps track of the current position in the stream I
using the
Positioner
trait to update the position.
Fields
position: I::Item::Position
The current position
input: I
The input stream used when items are requested
Methods
impl<I> State<I> where I: Stream, I::Item: Positioner
[src]
fn new(input: I) -> State<I>
Creates a new State<I>
from an input stream. Initializes the position to
Positioner::start()
.
Trait Implementations
impl<I: Clone> Clone for State<I> where I: Stream,
I::Item: Positioner,
I::Item: Clone
[src]
I::Item: Positioner,
I::Item: Clone
fn clone(&self) -> State<I>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<I: PartialEq> PartialEq for State<I> where I: Stream,
I::Item: Positioner,
I::Item: PartialEq
[src]
I::Item: Positioner,
I::Item: PartialEq
fn eq(&self, __arg_0: &State<I>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &State<I>) -> bool
This method tests for !=
.
impl<I> Debug for State<I> where I: Stream + Debug,
I::Item: Positioner,
I::Item::Position: Debug
[src]
I::Item: Positioner,
I::Item::Position: Debug
impl<I> StreamOnce for State<I> where I: Stream, I::Item: Positioner
[src]
type Item = I::Item
The type of items which is yielded from this stream.
type Range = I::Range
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. Read more
type Position = I::Item::Position
Type which represents the position in a stream. Ord
is required to allow parsers to determine which of two positions are further ahead. Read more
fn uncons(&mut self) -> Result<I::Item, Error<I::Item, I::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. Read more
fn position(&self) -> Self::Position
Returns the current position of the stream.
impl<I, E> RangeStream for State<I> where I: RangeStream<Item=E>,
I::Range: Range + Positioner<Position=E::Position>,
E: Positioner + Clone
[src]
I::Range: Range + Positioner<Position=E::Position>,
E: Positioner + Clone
fn uncons_range(&mut self,
size: usize)
-> Result<I::Range, Error<I::Item, I::Range>>
size: usize)
-> Result<I::Range, Error<I::Item, I::Range>>
Takes size
elements from the stream. Fails if the length of the stream is less than size
. Read more
fn uncons_while<F>(&mut self,
predicate: F)
-> Result<I::Range, Error<I::Item, I::Range>> where F: FnMut(I::Item) -> bool
predicate: F)
-> Result<I::Range, Error<I::Item, I::Range>> where F: FnMut(I::Item) -> bool
Takes items from stream, testing each one with predicate
. returns the range of items which passed predicate
. Read more