pub struct Token {
pub kind: TokenKind,
pub flags: u8,
pub start: u32,
pub end: u32,
}Expand description
Compact 12-byte lossless lexical token referencing a byte span [start, end) in src.
Fields§
§kind: TokenKind§flags: u8§start: u32§end: u32Implementations§
Source§impl Token
impl Token
pub const fn new(kind: TokenKind, flags: u8, start: u32, end: u32) -> Self
pub const fn len(self) -> u32
pub const fn is_empty(self) -> bool
pub const fn is_trivia(self) -> bool
pub const fn is_joint(self) -> bool
pub const fn has_error(self) -> bool
pub const fn range(self) -> Range<usize> ⓘ
pub fn text(self, src: &str) -> &str
Trait Implementations§
impl Copy for Token
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Forget for Token
impl Freeze for Token
impl Move 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