pub struct Token {
pub kind: TokenKind,
pub span: Span,
}Fields§
§kind: TokenKindWhat kind of token this is.
span: SpanWhere in the source text this token appears.
Implementations§
Source§impl Token
impl Token
Sourcepub fn symbol_eq(&self, s: &str) -> bool
pub fn symbol_eq(&self, s: &str) -> bool
Return true if this token is a TokenKind::Symbol matching s (case-insensitive).
§Arguments
s- The symbol string to compare against (e.g."define","and")
Sourcepub fn keyword_eq(&self, s: &str) -> bool
pub fn keyword_eq(&self, s: &str) -> bool
Return true if this token is a TokenKind::Keyword matching s (case-insensitive).
§Arguments
s- The keyword to compare against, without the leading:(e.g."requirements")
Sourcepub fn variable_eq(&self, s: &str) -> bool
pub fn variable_eq(&self, s: &str) -> bool
Return true if this token is a TokenKind::Variable matching s (case-insensitive).
§Arguments
s- The variable to compare against, with the leading?(e.g."?x")
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 UnsafeUnpin 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