pub struct State<I>where
I: Stream,{
pub position: <I::Item as Positioner>::Position,
pub input: I,
}
Expand description
The State<I>
struct keeps track of the current position in the stream I
Fields§
§position: <I::Item as Positioner>::Position
§input: I
Implementations§
Source§impl<I: Stream> State<I>
impl<I: Stream> State<I>
pub fn new(input: I) -> State<I>
pub fn as_empty(&self) -> State<I>
Sourcepub fn uncons(self) -> ParseResult<I::Item, I, I::Item>
pub fn uncons(self) -> ParseResult<I::Item, I, I::Item>
uncons
is the most general way of extracting and item from a stream
It takes a function f
as argument which should update the position
according to the item that was extracted
Usually you want to use uncons_char
instead which works directly on character streams
pub fn update(self, i: I::Item, rest: I) -> ParseResult<I::Item, I, I::Item>
Trait Implementations§
impl<I> StructuralPartialEq for State<I>where
I: Stream,
Auto Trait Implementations§
impl<I> Freeze for State<I>
impl<I> RefUnwindSafe for State<I>
impl<I> Send for State<I>
impl<I> Sync for State<I>
impl<I> Unpin for State<I>
impl<I> UnwindSafe for State<I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more