pub enum Token<'tk> {
Colon,
Comma,
ArrayOpen,
ArrayClose,
ObjectOpen,
ObjectClose,
Null,
False,
True,
Whitespace {
raw: Cow<'tk, str>,
},
Number {
raw: Cow<'tk, str>,
integer: Cow<'tk, [u8]>,
fraction: Cow<'tk, [u8]>,
exponent: Cow<'tk, [u8]>,
integer_sign: Sign,
exponent_sign: Sign,
},
String {
raw: Cow<'tk, str>,
chars: Cow<'tk, str>,
},
}Expand description
Enumeration of all possible tokens that can be yielded by the tokenizer.
Note that tokens can reference temporary values of the tokenizer (tied to
the lifetime 'tk). Use Token::own() to duplicate these values and
provide an unrestricted copy of the token.
Variants§
Colon
JSON colon token
Comma
JSON comma token
ArrayOpen
JSON open-array token
ArrayClose
JSON close-array token
ObjectOpen
JSON open-object token
ObjectClose
JSON close-object token
Null
JSON null keyword
False
JSON false keyword
True
JSON true keyword
Whitespace
Block of continuous whitespace
Number
JSON number value
Fields
String
JSON string value
Implementations§
Trait Implementations§
impl<'tk> Eq for Token<'tk>
Source§impl<'tk> Ord for Token<'tk>
impl<'tk> Ord for Token<'tk>
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<'tk> PartialEq for Token<'tk>
impl<'tk> PartialEq for Token<'tk>
Source§impl<'tk> PartialOrd for Token<'tk>
impl<'tk> PartialOrd for Token<'tk>
impl<'tk> StructuralPartialEq for Token<'tk>
Auto Trait Implementations§
impl<'tk> Freeze for Token<'tk>
impl<'tk> RefUnwindSafe for Token<'tk>
impl<'tk> Send for Token<'tk>
impl<'tk> Sync for Token<'tk>
impl<'tk> Unpin for Token<'tk>
impl<'tk> UnsafeUnpin for Token<'tk>
impl<'tk> UnwindSafe for Token<'tk>
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