[−][src]Struct pear::input::Cursor
Fields
start: T
items: T
Trait Implementations
impl<T: Debug> Debug for Cursor<T>
[src]
impl<T: Copy> From<T> for Cursor<T>
[src]
impl<T: Indexable + Show + Length + PartialEq> Input for Cursor<T> where
T::One: Show + PartialEq,
[src]
T::One: Show + PartialEq,
type Token = T::One
type Slice = Extent<T>
type Many = Extent<T>
type Marker = usize
type Context = Extent<T>
fn token(&mut self) -> Option<Self::Token>
[src]
Returns a copy of the current token, if there is one.
fn slice(&mut self, n: usize) -> Option<Self::Slice>
[src]
Returns a copy of the current slice of size n
, if there is one.
fn peek<F>(&mut self, cond: F) -> bool where
F: FnMut(&Self::Token) -> bool,
[src]
F: FnMut(&Self::Token) -> bool,
Checks if the current token fulfills cond
.
fn peek_slice<F>(&mut self, n: usize, cond: F) -> bool where
F: FnMut(&Self::Slice) -> bool,
[src]
F: FnMut(&Self::Slice) -> bool,
Checks if the current slice of size n
(if any) fulfills cond
.
fn eat<F>(&mut self, cond: F) -> Option<Self::Token> where
F: FnMut(&Self::Token) -> bool,
[src]
F: FnMut(&Self::Token) -> bool,
Checks if the current token fulfills cond
. If so, the token is
consumed and returned. Otherwise, returns None
.
fn eat_slice<F>(&mut self, n: usize, cond: F) -> Option<Self::Slice> where
F: FnMut(&Self::Slice) -> bool,
[src]
F: FnMut(&Self::Slice) -> bool,
Checks if the current slice of size n
(if any) fulfills cond
. If so,
the slice is consumed and returned. Otherwise, returns None
.
fn take<F>(&mut self, cond: F) -> Self::Many where
F: FnMut(&Self::Token) -> bool,
[src]
F: FnMut(&Self::Token) -> bool,
Takes tokens while cond
returns true, collecting them into a
Self::Many
and returning it.
fn skip<F>(&mut self, cond: F) -> usize where
F: FnMut(&Self::Token) -> bool,
[src]
F: FnMut(&Self::Token) -> bool,
Skips tokens while cond
returns true. Returns the number of skipped
tokens.
fn has(&mut self, n: usize) -> bool
[src]
Returns true
if there are at least n
tokens remaining.
fn mark(&mut self, _: &ParserInfo) -> Self::Marker
[src]
fn context(&mut self, mark: Self::Marker) -> Self::Context
[src]
Optionally returns a context to identify the current input position. By
default, this method returns None
, indicating that no context could be
resolved.
impl<T: Indexable + Show + Length + PartialEq> Rewind for Cursor<T> where
T::One: Show + PartialEq,
[src]
T::One: Show + PartialEq,
Auto Trait Implementations
impl<T> RefUnwindSafe for Cursor<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Cursor<T> where
T: Send,
T: Send,
impl<T> Sync for Cursor<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Cursor<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Cursor<T> where
T: UnwindSafe,
T: 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,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,