Skip to main content

Token

Enum Token 

Source
pub enum Token<'source, 'ast> {
Show 60 variants Eof, Ident(AstName<'ast>), Comment(&'source [u8]), BlockComment(usize), BrokenComment, Reserved(ReservedWord), InterpStringBegin(&'source [u8]), InterpStringMid(&'source [u8]), InterpStringEnd(&'source [u8]), InterpStringSimple(&'source [u8]), BrokenInterpDoubleBrace(&'source [u8]), Number(&'source [u8]), QuotedString { value: &'source [u8], quote_style: QuoteStyle, }, RawString { value: &'source [u8], block_depth: usize, }, BrokenString, Error, BrokenUnicode { codepoint: u32, }, Attribute(AstName<'ast>), AttributeOpen, Ampersand, Bang, Hash, LeftBrace, LeftBracket, Plus, PlusEqual, Minus, MinusEqual, SkinnyArrow, Star, StarEqual, Slash, SlashEqual, SlashSlash, SlashSlashEqual, Percent, PercentEqual, Question, Caret, CaretEqual, Colon, DoubleColon, Comma, Dot, DotDot, DotDotEqual, Equal, EqualEqual, Ellipsis, Greater, GreaterEqual, Less, LessEqual, LeftParen, Pipe, RightBrace, RightBracket, RightParen, Semicolon, TildeEqual,
}

Variants§

§

Eof

§

Ident(AstName<'ast>)

§

Comment(&'source [u8])

§

BlockComment(usize)

§

BrokenComment

§

Reserved(ReservedWord)

§

InterpStringBegin(&'source [u8])

§

InterpStringMid(&'source [u8])

§

InterpStringEnd(&'source [u8])

§

InterpStringSimple(&'source [u8])

§

BrokenInterpDoubleBrace(&'source [u8])

§

Number(&'source [u8])

§

QuotedString

Fields

§value: &'source [u8]
§quote_style: QuoteStyle
§

RawString

Fields

§value: &'source [u8]
§block_depth: usize
§

BrokenString

§

Error

§

BrokenUnicode

Fields

§codepoint: u32
§

Attribute(AstName<'ast>)

§

AttributeOpen

§

Ampersand

§

Bang

§

Hash

§

LeftBrace

§

LeftBracket

§

Plus

§

PlusEqual

§

Minus

§

MinusEqual

§

SkinnyArrow

§

Star

§

StarEqual

§

Slash

§

SlashEqual

§

SlashSlash

§

SlashSlashEqual

§

Percent

§

PercentEqual

§

Question

§

Caret

§

CaretEqual

§

Colon

§

DoubleColon

§

Comma

§

Dot

§

DotDot

§

DotDotEqual

§

Equal

§

EqualEqual

§

Ellipsis

§

Greater

§

GreaterEqual

§

Less

§

LessEqual

§

LeftParen

§

Pipe

§

RightBrace

§

RightBracket

§

RightParen

§

Semicolon

§

TildeEqual

Implementations§

Source§

impl Token<'_, '_>

Source

pub const fn kind(self) -> TokenKind

Source

pub fn name(&self) -> &'static str

Trait Implementations§

Source§

impl<'source, 'ast> Clone for Token<'source, 'ast>

Source§

fn clone(&self) -> Token<'source, 'ast>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'source, 'ast> Copy for Token<'source, 'ast>

Source§

impl<'source, 'ast> Debug for Token<'source, 'ast>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Token<'_, '_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'source, 'ast> PartialEq for Token<'source, 'ast>

Source§

fn eq(&self, other: &Token<'source, 'ast>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'source, 'ast> StructuralPartialEq for Token<'source, 'ast>

Auto Trait Implementations§

§

impl<'source, 'ast> Freeze for Token<'source, 'ast>

§

impl<'source, 'ast> RefUnwindSafe for Token<'source, 'ast>

§

impl<'source, 'ast> Send for Token<'source, 'ast>

§

impl<'source, 'ast> Sync for Token<'source, 'ast>

§

impl<'source, 'ast> Unpin for Token<'source, 'ast>

§

impl<'source, 'ast> UnsafeUnpin for Token<'source, 'ast>

§

impl<'source, 'ast> UnwindSafe for Token<'source, 'ast>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.