[][src]Struct hatter::Token

pub struct Token<'s> {
    pub pos: usize,
    pub len: usize,
    pub kind: Syntax,
    // some fields omitted
}

A Token is an element of source code, a Syntax and its position.

Fields

pos: usizelen: usizekind: Syntax

Implementations

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

pub fn new(kind: Syntax, pos: usize, len: usize, lit: &'s str) -> Token<'s>[src]

Create a Token.

pub fn is_literal(&self) -> bool[src]

Will it produce a literal()?

pub fn literal(&self) -> &str[src]

Get the literal value in source code, if it has one.

pub fn to_str(&self) -> &str[src]

Also...

pub fn to_sym(&self) -> Symbol[src]

Intern string.

pub fn to_string(&self) -> String[src]

Create a string of the literal value.

pub fn to_f64(&self) -> Result<f64>[src]

Convert into native number or error. No weak typing.

Trait Implementations

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

impl<'s> Copy for Token<'s>[src]

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

Auto Trait Implementations

impl<'s> RefUnwindSafe for Token<'s>

impl<'s> Send for Token<'s>

impl<'s> Sync for Token<'s>

impl<'s> Unpin for Token<'s>

impl<'s> UnwindSafe for Token<'s>

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.