pub enum Token {
Show 31 variants
Ident(&'static [u8]),
Function(&'static [u8]),
AtKeyword(&'static [u8]),
UnrestrictedHash(&'static [u8]),
IdHash(&'static [u8]),
QuotedString(&'static [u8]),
BadString(&'static [u8]),
UnquotedUrl(&'static [u8]),
BadUrl(&'static [u8]),
Delim(u32),
Number(Num),
Percentage {
has_sign: bool,
unit_value: f32,
int_value: Option<i32>,
},
Dimension(Dimension),
Whitespace(&'static [u8]),
Cdo,
Cdc,
IncludeMatch,
DashMatch,
PrefixMatch,
SuffixMatch,
SubstringMatch,
Colon,
Semicolon,
Comma,
OpenSquare,
CloseSquare,
OpenParen,
CloseParen,
OpenCurly,
CloseCurly,
Comment(&'static [u8]),
}Expand description
CSS lexer token. Data-only definition hoisted out of css_parser.rs; the
to_css*/eql/hash impls stay in css_parser.rs (gated) since they
depend on serializer::* and generics.
Variants§
Ident(&'static [u8])
Function(&'static [u8])
AtKeyword(&'static [u8])
UnrestrictedHash(&'static [u8])
IdHash(&'static [u8])
QuotedString(&'static [u8])
BadString(&'static [u8])
UnquotedUrl(&'static [u8])
BadUrl(&'static [u8])
Delim(u32)
A <delim-token> — single codepoint. In practice always ASCII.
Number(Num)
Percentage
Dimension(Dimension)
Whitespace(&'static [u8])
Cdo
<!--
Cdc
-->
IncludeMatch
DashMatch
PrefixMatch
SuffixMatch
SubstringMatch
Colon
Semicolon
Comma
OpenSquare
CloseSquare
OpenParen
CloseParen
OpenCurly
CloseCurly
Comment(&'static [u8])
Not an actual token in the spec, but we keep it anyway
Implementations§
Source§impl Token
impl Token
pub fn eql(lhs: &Token, rhs: &Token) -> bool
pub fn hash(&self, hasher: &mut Wyhash)
Sourcepub fn is_parse_error(&self) -> bool
pub fn is_parse_error(&self) -> bool
Return whether this token represents a parse error.
pub fn kind(&self) -> TokenKind
pub fn kind_string(&self) -> &'static str
pub fn raw(&self) -> &[u8] ⓘ
pub fn to_css_generic<W: WriteAll + ?Sized>(&self, writer: &mut W) -> Result<()>
pub fn to_css(&self, dest: &mut Printer<'_>) -> Result<(), PrintErr>
Trait Implementations§
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> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.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