Struct combine::stream::state::State [−][src]
The State<I>
struct maintains the current position in the stream I
using
the Positioner
trait to track the position.
let result = token(b'9') .message("Not a nine") .easy_parse(State::new(&b"8"[..])); assert_eq!(result, Err(easy::Errors { position: 0, errors: vec![ easy::Error::Unexpected(b'8'.into()), easy::Error::Expected(b'9'.into()), easy::Error::Message("Not a nine".into()) ] }));
Fields
input: I
The input stream used when items are requested
positioner: X
The positioner used to update the current position
Implementations
impl<I, X> State<I, X> where
I: StreamOnce,
X: Positioner<I::Item>,
[src]
I: StreamOnce,
X: Positioner<I::Item>,
pub fn with_positioner(input: I, positioner: X) -> State<I, X>
[src]
Creates a new State<I, X>
from an input stream and a positioner.
impl<I> State<I, I::Positioner> where
I: StreamOnce + DefaultPositioned,
I::Positioner: Positioner<I::Item>,
[src]
I: StreamOnce + DefaultPositioned,
I::Positioner: Positioner<I::Item>,
pub fn new(input: I) -> State<I, I::Positioner>
[src]
Creates a new State<I, X>
from an input stream and its default positioner.
Trait Implementations
impl<I: Clone, X: Clone> Clone for State<I, X>
[src]
impl<I: Debug, X: Debug> Debug for State<I, X>
[src]
impl<I, X, E> FullRangeStream for State<I, X> where
I: FullRangeStream + Resetable,
I::Position: Clone + Ord,
E: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = E>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = E>,
X: Resetable + RangePositioner<I::Item, I::Range>,
[src]
I: FullRangeStream + Resetable,
I::Position: Clone + Ord,
E: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = E>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = E>,
X: Resetable + RangePositioner<I::Item, I::Range>,
impl<I: PartialEq, X: PartialEq> PartialEq<State<I, X>> for State<I, X>
[src]
impl<I, X, E> Positioned for State<I, X> where
I: StreamOnce,
X: Positioner<I::Item>,
E: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = E>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = E>,
[src]
I: StreamOnce,
X: Positioner<I::Item>,
E: StreamError<I::Item, I::Range>,
I::Error: ParseError<I::Item, I::Range, X::Position, StreamError = E>,
I::Error: ParseError<I::Item, I::Range, I::Position, StreamError = E>,
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<I, X> Resetable for State<I, X> where
I: Resetable,
X: Resetable,
[src]
I: Resetable,
X: Resetable,
type Checkpoint = State<I::Checkpoint, X::Checkpoint>
fn checkpoint(&self) -> Self::Checkpoint
[src]
fn reset(&mut self, checkpoint: Self::Checkpoint)
[src]
impl<I, X, S> StreamOnce for State<I, X> where
I: StreamOnce,
X: Positioner<I::Item>,
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>,
[src]
I: StreamOnce,
X: Positioner<I::Item>,
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>,
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 = X::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
type Error = I::Error
fn uncons(&mut self) -> Result<I::Item, StreamErrorFor<Self>>
[src]
fn is_partial(&self) -> bool
[src]
impl<I, X> StructuralPartialEq for State<I, X>
[src]
Auto Trait Implementations
impl<I, X> RefUnwindSafe for State<I, X> where
I: RefUnwindSafe,
X: RefUnwindSafe,
I: RefUnwindSafe,
X: RefUnwindSafe,
impl<I, X> Send for State<I, X> where
I: Send,
X: Send,
I: Send,
X: Send,
impl<I, X> Sync for State<I, X> where
I: Sync,
X: Sync,
I: Sync,
X: Sync,
impl<I, X> Unpin for State<I, X> where
I: Unpin,
X: Unpin,
I: Unpin,
X: Unpin,
impl<I, X> UnwindSafe for State<I, X> where
I: UnwindSafe,
X: UnwindSafe,
I: UnwindSafe,
X: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> RangeStream for I where
I: RangeStreamOnce + Stream,
[src]
I: RangeStreamOnce + Stream,
impl<I> Stream for I where
I: StreamOnce + Positioned + Resetable,
<I as StreamOnce>::Error: ParseError<<I as StreamOnce>::Item, <I as StreamOnce>::Range, <I as StreamOnce>::Position>,
[src]
I: StreamOnce + Positioned + Resetable,
<I as StreamOnce>::Error: ParseError<<I as StreamOnce>::Item, <I as StreamOnce>::Range, <I as StreamOnce>::Position>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,