[][src]Struct interact::Token

pub struct Token<'a> {
    pub kind: TokenKind,
    pub text: Cow<'a, str>,
    pub space_diff: usize,
}

Represents a single meaningful substring part in an Interact string expression.

Fields

kind: TokenKind

Token kind

text: Cow<'a, str>

Token text

space_diff: usize

Amount of whitespace from the previous token

Methods

impl<'a> Token<'a>[src]

pub fn new_owned(s: String) -> Self[src]

pub fn new_borrowed(kind: TokenKind, s: &'static str) -> Self[src]

pub fn clone_owned(&self) -> Token<'static>[src]

pub fn similar(&self, token: &Token) -> bool[src]

Returns whether two tokens are idential with whitespace removed.

pub fn is_prefix_of(&self, token: &Token) -> bool[src]

Returns whether one token is a prefix or another.

pub fn space_suffix(&self) -> usize[src]

Return the amount of space following the text of the token.

Trait Implementations

impl<'a> PartialEq<Token<'a>> for Token<'a>[src]

impl<'a> Eq for Token<'a>[src]

impl<'a> Clone for Token<'a>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for Token<'a>[src]

Auto Trait Implementations

impl<'a> Send for Token<'a>

impl<'a> Sync for Token<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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