Struct combine::State
[−]
[src]
pub struct State<I> where
I: Stream,
I::Item: Positioner, { pub position: <I::Item as Positioner>::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 as Positioner>::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]
impl<I> State<I> where
I: Stream,
I::Item: Positioner,
pub fn new(input: I) -> State<I>
[src]
pub 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]
impl<I: Clone> Clone for State<I> where
I: Stream,
I::Item: Positioner,
I::Item: Clone,
fn clone(&self) -> State<I>
[src]
fn clone(&self) -> State<I>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<I: PartialEq> PartialEq for State<I> where
I: Stream,
I::Item: Positioner,
I::Item: PartialEq,
[src]
impl<I: PartialEq> PartialEq for State<I> where
I: Stream,
I::Item: Positioner,
I::Item: PartialEq,
fn eq(&self, __arg_0: &State<I>) -> bool
[src]
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
[src]
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 as Positioner>::Position: Debug,
[src]
impl<I> Debug for State<I> where
I: Stream + Debug,
I::Item: Positioner,
<I::Item as Positioner>::Position: Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<I> StreamOnce for State<I> where
I: Stream,
I::Item: Positioner,
[src]
impl<I> StreamOnce for State<I> where
I: Stream,
I::Item: Positioner,
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 as Positioner>::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>>
[src]
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
[src]
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]
impl<I, E> RangeStream for State<I> where
I: RangeStream<Item = E>,
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>>
[src]
fn uncons_range(
&mut self,
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,
[src]
fn uncons_while<F>(
&mut self,
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
impl<I, E> FullRangeStream for State<I> where
I: RangeStream<Item = E>,
I::Range: Range + Positioner<Position = E::Position>,
E: Positioner + Clone,
I: FullRangeStream,
[src]
impl<I, E> FullRangeStream for State<I> where
I: RangeStream<Item = E>,
I::Range: Range + Positioner<Position = E::Position>,
E: Positioner + Clone,
I: FullRangeStream,
Auto Trait Implementations
impl<I> Send for State<I> where
I: Send,
<<I as StreamOnce>::Item as Positioner>::Position: Send,
impl<I> Send for State<I> where
I: Send,
<<I as StreamOnce>::Item as Positioner>::Position: Send,
impl<I> Sync for State<I> where
I: Sync,
<<I as StreamOnce>::Item as Positioner>::Position: Sync,
impl<I> Sync for State<I> where
I: Sync,
<<I as StreamOnce>::Item as Positioner>::Position: Sync,