pub enum Token<'a> {
Show 31 variants
Ident(CowArcStr<'a>),
AtKeyword(CowArcStr<'a>),
Hash(CowArcStr<'a>),
IDHash(CowArcStr<'a>),
String(CowArcStr<'a>),
UnquotedUrl(CowArcStr<'a>),
Delim(char),
Number {
has_sign: bool,
value: f32,
int_value: Option<i32>,
},
Percentage {
has_sign: bool,
unit_value: f32,
int_value: Option<i32>,
},
Dimension {
has_sign: bool,
value: f32,
int_value: Option<i32>,
unit: CowArcStr<'a>,
},
WhiteSpace(CowArcStr<'a>),
Comment(CowArcStr<'a>),
Colon,
Semicolon,
Comma,
IncludeMatch,
DashMatch,
PrefixMatch,
SuffixMatch,
SubstringMatch,
CDO,
CDC,
Function(CowArcStr<'a>),
ParenthesisBlock,
SquareBracketBlock,
CurlyBracketBlock,
BadUrl(CowArcStr<'a>),
BadString(CowArcStr<'a>),
CloseParenthesis,
CloseSquareBracket,
CloseCurlyBracket,
}
Expand description
A raw CSS token.
Variants§
Ident(CowArcStr<'a>)
AtKeyword(CowArcStr<'a>)
The value does not include the @
marker.
Hash(CowArcStr<'a>)
A <hash-token>
with the type flag set to “unrestricted”
The value does not include the #
marker.
IDHash(CowArcStr<'a>)
A <hash-token>
with the type flag set to “id”
The value does not include the #
marker.
String(CowArcStr<'a>)
The value does not include the quotes.
UnquotedUrl(CowArcStr<'a>)
The value does not include the url(
)
markers. Note that url( <string-token> )
is represented by a
Function
token.
Delim(char)
A <delim-token>
Number
Fields
Percentage
Fields
Dimension
Fields
has_sign: bool
Whether the number had a +
or -
sign.
This is used is some cases like the <An+B> micro syntax. (See the parse_nth
function.)
WhiteSpace(CowArcStr<'a>)
Comment(CowArcStr<'a>)
A comment.
The CSS Syntax spec does not generate tokens for comments, But we do, because we can (borrowed &str makes it cheap).
The value does not include the /*
*/
markers.
Colon
A :
<colon-token>
Semicolon
A ;
<semicolon-token>
Comma
A ,
<comma-token>
IncludeMatch
DashMatch
A |=
<dash-match-token>
PrefixMatch
A ^=
<prefix-match-token>
SuffixMatch
A $=
<suffix-match-token>
SubstringMatch
CDO
A <!--
<CDO-token>
CDC
A -->
<CDC-token>
Function(CowArcStr<'a>)
The value (name) does not include the (
marker.
ParenthesisBlock
A <(-token>
SquareBracketBlock
A <[-token>
CurlyBracketBlock
A <{-token>
BadUrl(CowArcStr<'a>)
A <bad-url-token>
This token always indicates a parse error.
BadString(CowArcStr<'a>)
A <bad-string-token>
This token always indicates a parse error.
CloseParenthesis
A <)-token>
When obtained from one of the Parser::next*
methods,
this token is always unmatched and indicates a parse error.
CloseSquareBracket
A <]-token>
When obtained from one of the Parser::next*
methods,
this token is always unmatched and indicates a parse error.
CloseCurlyBracket
A <}-token>
When obtained from one of the Parser::next*
methods,
this token is always unmatched and indicates a parse error.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Token<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Token<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'i> From<Token<'i>> for TokenOrValue<'i>
impl<'i> From<Token<'i>> for TokenOrValue<'i>
Source§fn from(token: Token<'i>) -> TokenOrValue<'i>
fn from(token: Token<'i>) -> TokenOrValue<'i>
Source§impl<'a> JsonSchema for Token<'a>
impl<'a> JsonSchema for Token<'a>
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl<'a> ToCss for Token<'a>
impl<'a> ToCss for Token<'a>
Source§fn to_css<W>(
&self,
dest: &mut Printer<'_, '_, '_, W>,
) -> Result<(), PrinterError>where
W: Write,
fn to_css<W>(
&self,
dest: &mut Printer<'_, '_, '_, W>,
) -> Result<(), PrinterError>where
W: Write,
self
in CSS syntax, writing to dest
.Source§fn to_css_string(
&self,
options: PrinterOptions<'_>,
) -> Result<String, PrinterError>
fn to_css_string( &self, options: PrinterOptions<'_>, ) -> Result<String, PrinterError>
self
in CSS syntax and return a string. Read moreSource§impl<'a, __T: Visit<'a, __T, __V>, __V: ?Sized + Visitor<'a, __T>> Visit<'a, __T, __V> for Token<'a>
impl<'a, __T: Visit<'a, __T, __V>, __V: ?Sized + Visitor<'a, __T>> Visit<'a, __T, __V> for Token<'a>
Source§const CHILD_TYPES: VisitTypes
const CHILD_TYPES: VisitTypes
visitor
only.impl<'a> Eq for Token<'a>
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more