[][src]Struct pear::input::Cursor

pub struct Cursor<T> {
    pub start: T,
    pub items: T,
}

Fields

start: Titems: 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]

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]

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]

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]

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]

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]

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]

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 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]

Auto Trait Implementations

impl<T> RefUnwindSafe for Cursor<T> where
    T: RefUnwindSafe

impl<T> Send for Cursor<T> where
    T: Send

impl<T> Sync for Cursor<T> where
    T: Sync

impl<T> Unpin for Cursor<T> where
    T: Unpin

impl<T> UnwindSafe for Cursor<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.