pub struct Token {
pub kind: TokenKind,
pub span: Span,
}Expand description
A token with its span in the source code.
Fields§
§kind: TokenKindThe kind of token.
span: SpanThe location in the source code.
Implementations§
Source§impl Token
impl Token
Sourcepub const fn is_keyword(&self) -> bool
pub const fn is_keyword(&self) -> bool
Returns true if this is a keyword.
Sourcepub const fn as_keyword(&self) -> Option<Keyword>
pub const fn as_keyword(&self) -> Option<Keyword>
Returns the keyword if this is a keyword token.
Trait Implementations§
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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