pub enum Token {
Color(Color),
Length(Length),
BoxEdges(BoxEdges),
BorderStyle(BorderStyle),
Var {
name: String,
},
}Expand description
A CSS custom-property value. Supports Color, Length, BoxEdges
(for padding/margin), and BorderStyle (for border-style). These
are the value types whose fields carry var() references: the color fields
(color, background, underline-color, border color), the length fields
(width/height), padding/margin, and a border’s style. A border’s
edges (Borders) cannot yet be driven by var().
Token::Var covers the case where a custom property is itself a bare
var(--other) reference: its ultimate type (color vs length vs edges vs
style) is not knowable at parse time, so it is stored untyped and resolved by
following the chain via ThemeTokens::get_color /
ThemeTokens::get_length / ThemeTokens::get_box_edges /
ThemeTokens::get_border_style.
Variants§
Color(Color)
Length(Length)
BoxEdges(BoxEdges)
BorderStyle(BorderStyle)
Var
A bare var(--other) reference whose type is determined by what --other
ultimately resolves to. Every typed getter follows the chain.
Trait Implementations§
Source§impl From<&str> for Token
Parse a CSS string into a Token. Mirrors [Color::from(&str)]: a valid
color expression becomes Token::Color; anything else (including a valid
length like "50%") degrades to a reset color. This keeps the ergonomic
tokens_mut().insert("accent", "#00d4ff") form working for the common
color case; for a length token, pass a Length explicitly.
impl From<&str> for Token
Parse a CSS string into a Token. Mirrors [Color::from(&str)]: a valid
color expression becomes Token::Color; anything else (including a valid
length like "50%") degrades to a reset color. This keeps the ergonomic
tokens_mut().insert("accent", "#00d4ff") form working for the common
color case; for a length token, pass a Length explicitly.
Source§impl From<BorderStyle> for Token
impl From<BorderStyle> for Token
Source§fn from(b: BorderStyle) -> Self
fn from(b: BorderStyle) -> Self
impl StructuralPartialEq for Token
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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