Enum parcel_css::properties::custom::Token
source · [−]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(&'a str),
Comment(&'a str),
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
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.)
value: f32
The value as a float
Percentage
Fields
has_sign: bool
Whether the number had a +
or -
sign.
unit_value: f32
The value as a float, divided by 100 so that the nominal range is 0.0 to 1.0.
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.)
value: f32
The value as a float
int_value: Option<i32>
If the origin source did not include a fractional part, the value as an integer.
unit: CowArcStr<'a>
The unit, e.g. “px” in 12px
WhiteSpace(&'a str)
Comment(&'a str)
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
sourceimpl<'i> From<Token<'i>> for TokenOrValue<'i>
impl<'i> From<Token<'i>> for TokenOrValue<'i>
sourcefn from(token: Token<'i>) -> TokenOrValue<'i>
fn from(token: Token<'i>) -> TokenOrValue<'i>
Converts to this type from the input type.
sourceimpl<'a> ToCss for Token<'a>
impl<'a> ToCss for Token<'a>
sourcefn 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,
Serialize self
in CSS syntax, writing to dest
.
sourcefn to_css_string(
&self,
options: PrinterOptions<'_>
) -> Result<String, PrinterError>
fn to_css_string(
&self,
options: PrinterOptions<'_>
) -> Result<String, PrinterError>
Serialize self
in CSS syntax and return a string. Read more
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations
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
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer