Struct commands::tokenizer::Token [] [src]

pub struct Token<'text> {
    pub text: &'text str,
    pub token_type: TokenType,
    pub location: SourceLocation,
}

A token from a body of text.

The lifetime parameter 'text refers to the lifetime of the body of text that was tokenized, creating this token.

Fields

text

The text of the token.

token_type

The type of the token (Whitespace or Word).

location

The location of the token in the source body of text.

Methods

impl<'text> Token<'text>

fn new(text: &'text str, token_type: TokenType, location: SourceLocation) -> Token

Construct a Token. The lifetime parameter 'text refers to the lifetime of the text being tokenized.

Trait Implementations

Derived Implementations

impl<'text> PartialEq for Token<'text>

fn eq(&self, __arg_0: &Token<'text>) -> bool

fn ne(&self, __arg_0: &Token<'text>) -> bool

impl<'text> Debug for Token<'text>

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<'text> Copy for Token<'text>

impl<'text> Clone for Token<'text>

fn clone(&self) -> Token<'text>

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