pub struct Token {
pub kind: TokenType,
pub span: Span,
}Expand description
A lexical token, identifying its kind and span.
We define our own Token as the json_tools::Token defines a Buffer that can be heap allocated
or a Span. We only use the Span variant.
Our Token can also impl Copy and Clone as the size and semantics are acceptable.
Fields§
§kind: TokenTypeThe exact type of the token.
span: SpanThe span allows the caller to reference back into the source byte stream to obtain the string making up the token.
Trait Implementations§
Source§impl Ord for Token
impl Ord for Token
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Token
impl PartialOrd for Token
impl Copy for Token
impl Eq for Token
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