[−][src]Struct hatter::Token
A Token is an element of source code, a Syntax
and its position.
Fields
pos: usize
len: usize
kind: 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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,