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

Implementations

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> Clone for Token<'a>[src]

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

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

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

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

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for Token<'a>

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

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

impl<'a> Unpin for Token<'a>

impl<'a> UnwindSafe for Token<'a>

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<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.