pub struct Token<'text> {
pub text: &'text str,
pub token_type: TokenType,
pub location: SourceLocation,
}
Expand description
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: &'text str
The text of the token.
token_type: TokenType
The type of the token (Whitespace
or Word
).
location: SourceLocation
The location of the token in the source body of text.
Implementations§
Trait Implementations§
impl<'text> Copy for Token<'text>
impl<'text> StructuralPartialEq for Token<'text>
Auto Trait Implementations§
impl<'text> Freeze for Token<'text>
impl<'text> RefUnwindSafe for Token<'text>
impl<'text> Send for Token<'text>
impl<'text> Sync for Token<'text>
impl<'text> Unpin for Token<'text>
impl<'text> UnwindSafe for Token<'text>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more