Struct Tokens

Source
pub struct Tokens<'a> {
    pub tok: &'a [Token],
    pub start: usize,
    pub end: usize,
}

Fields§

§tok: &'a [Token]§start: usize§end: usize

Implementations§

Source§

impl<'a> Tokens<'a>

Source

pub fn new(vec: &'a [Token]) -> Self

Trait Implementations§

Source§

impl<'a> Clone for Tokens<'a>

Source§

fn clone(&self) -> Tokens<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Tokens<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> InputIter for Tokens<'a>

Source§

type Item = &'a Token

The current input type is a sequence of that Item type. Read more
Source§

type Iter = Enumerate<Iter<'a, Token>>

An iterator over the input type, producing the item and its position for use with Slice. If we’re iterating over &str, the position corresponds to the byte index of the character
Source§

type IterElem = Iter<'a, Token>

An iterator over the input type, producing the item
Source§

fn iter_indices(&self) -> Enumerate<Iter<'a, Token>>

Returns an iterator over the elements and their byte offsets
Source§

fn iter_elements(&self) -> Iter<'a, Token>

Returns an iterator over the elements
Source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

Finds the byte position of the element
Source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

Get the byte offset from the element’s position in the stream
Source§

impl<'a> InputLength for Tokens<'a>

Source§

fn input_len(&self) -> usize

Calculates the input length, as indicated by its name, and the name of the trait itself
Source§

impl<'a> InputTake for Tokens<'a>

Source§

fn take(&self, count: usize) -> Self

Returns a slice of count bytes. panics if count > length
Source§

fn take_split(&self, count: usize) -> (Self, Self)

Split the stream at the count byte offset. panics if count > length
Source§

impl<'a> PartialEq for Tokens<'a>

Source§

fn eq(&self, other: &Tokens<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Slice<Range<usize>> for Tokens<'a>

Source§

fn slice(&self, range: Range<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeFrom<usize>> for Tokens<'a>

Source§

fn slice(&self, range: RangeFrom<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeFull> for Tokens<'a>

Source§

fn slice(&self, _: RangeFull) -> Self

Slices self according to the range argument
Source§

impl<'a> Slice<RangeTo<usize>> for Tokens<'a>

Source§

fn slice(&self, range: RangeTo<usize>) -> Self

Slices self according to the range argument
Source§

impl<'a> Copy for Tokens<'a>

Source§

impl<'a> Eq for Tokens<'a>

Source§

impl<'a> StructuralPartialEq for Tokens<'a>

Source§

impl<'a> UnspecializedInput for Tokens<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Tokens<'a>

§

impl<'a> RefUnwindSafe for Tokens<'a>

§

impl<'a> Send for Tokens<'a>

§

impl<'a> Sync for Tokens<'a>

§

impl<'a> Unpin for Tokens<'a>

§

impl<'a> UnwindSafe for Tokens<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InputTakeAtPosition for T

Source§

type Item = <T as InputIter>::Item

The current input type is a sequence of that Item type. Read more
Source§

fn split_at_position<P, E>(&self, predicate: P) -> Result<(T, T), Err<E>>
where E: ParseError<T>, P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position. Read more
Source§

fn split_at_position1<P, E>( &self, predicate: P, e: ErrorKind, ) -> Result<(T, T), Err<E>>
where E: ParseError<T>, P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

Looks for the first element of the input type for which the condition returns true and returns the input up to this position. Read more
Source§

fn split_at_position_complete<P, E>( &self, predicate: P, ) -> Result<(T, T), Err<E>>
where E: ParseError<T>, P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position. Read more
Source§

fn split_at_position1_complete<P, E>( &self, predicate: P, e: ErrorKind, ) -> Result<(T, T), Err<E>>
where E: ParseError<T>, P: Fn(<T as InputTakeAtPosition>::Item) -> bool,

Looks for the first element of the input type for which the condition returns true and returns the input up to this position. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.