#[repr(u8)]pub enum TokenKind {
Show 84 variants
Whitespace = 0,
LineComment = 1,
BlockComment = 2,
Shebang = 3,
Ident = 4,
RawIdent = 5,
Lifetime = 6,
Int = 7,
Float = 8,
Char = 9,
Byte = 10,
Str = 11,
RawStr = 12,
ByteStr = 13,
RawByteStr = 14,
CStr = 15,
RawCStr = 16,
As = 17,
Async = 18,
Await = 19,
Break = 20,
Const = 21,
Continue = 22,
Crate = 23,
Dyn = 24,
Else = 25,
Enum = 26,
Extern = 27,
False = 28,
Fn = 29,
For = 30,
If = 31,
Impl = 32,
In = 33,
Let = 34,
Loop = 35,
Match = 36,
Mod = 37,
Move = 38,
Mut = 39,
Pub = 40,
Ref = 41,
Return = 42,
SelfKw = 43,
SelfType = 44,
Static = 45,
Struct = 46,
Super = 47,
Trait = 48,
True = 49,
Type = 50,
Unsafe = 51,
Use = 52,
Where = 53,
While = 54,
Underscore = 55,
LParen = 56,
RParen = 57,
LBrace = 58,
RBrace = 59,
LBracket = 60,
RBracket = 61,
Bang = 62,
Hash = 63,
Dollar = 64,
Percent = 65,
Amp = 66,
Star = 67,
Plus = 68,
Comma = 69,
Minus = 70,
Dot = 71,
Slash = 72,
Colon = 73,
Semi = 74,
Lt = 75,
Eq = 76,
Gt = 77,
Question = 78,
At = 79,
Caret = 80,
Pipe = 81,
Tilde = 82,
Unknown = 83,
}Expand description
Lexical kind of a Rust source token (edition-independent, context-free).
Variants§
Whitespace = 0
LineComment = 1
BlockComment = 2
Shebang = 3
Ident = 4
RawIdent = 5
Lifetime = 6
Int = 7
Float = 8
Char = 9
Byte = 10
Str = 11
RawStr = 12
ByteStr = 13
RawByteStr = 14
CStr = 15
RawCStr = 16
As = 17
Async = 18
Await = 19
Break = 20
Const = 21
Continue = 22
Crate = 23
Dyn = 24
Else = 25
Enum = 26
Extern = 27
False = 28
Fn = 29
For = 30
If = 31
Impl = 32
In = 33
Let = 34
Loop = 35
Match = 36
Mod = 37
Move = 38
Mut = 39
Pub = 40
Ref = 41
Return = 42
SelfKw = 43
SelfType = 44
Static = 45
Struct = 46
Super = 47
Trait = 48
True = 49
Type = 50
Unsafe = 51
Use = 52
Where = 53
While = 54
Underscore = 55
LParen = 56
RParen = 57
LBrace = 58
RBrace = 59
LBracket = 60
RBracket = 61
Bang = 62
Hash = 63
Dollar = 64
Percent = 65
Amp = 66
Star = 67
Plus = 68
Comma = 69
Minus = 70
Dot = 71
Slash = 72
Colon = 73
Semi = 74
Lt = 75
Eq = 76
Gt = 77
Question = 78
At = 79
Caret = 80
Pipe = 81
Tilde = 82
Unknown = 83
Implementations§
Source§impl TokenKind
impl TokenKind
Sourcepub const fn is_trivia(self) -> bool
pub const fn is_trivia(self) -> bool
Returns true for whitespace, comments (including doc comments), and file shebangs.
Sourcepub const fn is_punct(self) -> bool
pub const fn is_punct(self) -> bool
Returns true for non-delimiter atomic punctuation characters eligible for JOINT_NEXT.
Sourcepub const fn is_delimiter(self) -> bool
pub const fn is_delimiter(self) -> bool
Returns true for (, ), {, }, [, ].
Sourcepub const fn is_keyword(self) -> bool
pub const fn is_keyword(self) -> bool
Returns true for strict keywords (excluding Self::Underscore).
Sourcepub const fn is_literal(self) -> bool
pub const fn is_literal(self) -> bool
Returns true for numeric, character, byte, string, and C-string literals.
Sourcepub const fn punct_byte(self) -> Option<u8>
pub const fn punct_byte(self) -> Option<u8>
Maps an atomic punctuation TokenKind back to its ASCII byte, enabling fast
multi-character operator checks (at_op("::"), eat_op("->"), at_op(">>")) in the parser.
Trait Implementations§
impl Copy for TokenKind
impl Eq for TokenKind
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Forget for TokenKind
impl Freeze for TokenKind
impl Move for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnsafeUnpin for TokenKind
impl UnwindSafe for TokenKind
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