[−][src]Struct earl_lang_syntax::tokenizer::Token
A Token's id is its type, but I can't use type as the name of a field in
a struct.
A token keeps track of what kind of token it is, i.e. id, and at what byte it was found in
the input and how many bytes it spans.
- The field
idis what type of token this is. - The field
indexis the index of the byte where this token begins. - The field
lengthis how many bytes this token spans.
Fields
id: TokenIdasdfasdff
index: usizelength: usizeasdfasdff
lexeme: StringImplementations
impl Token[src]
pub fn new(id: TokenId, index: usize, length: usize) -> Token[src]
Creates a new token.
pub fn new_from_code(
id: TokenId,
index: usize,
length: usize,
code: &str
) -> Token[src]
id: TokenId,
index: usize,
length: usize,
code: &str
) -> Token
pub fn finalize(&mut self, code: &str)[src]
Convenience thing
pub fn get_lexeme<'a>(&self, code: &'a str) -> &'a str[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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,
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.
fn to_owned(&self) -> T[src]
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.
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>,