pub enum ResolvedValue {
Color(String),
CmykColor {
hex: String,
c: f32,
m: f32,
y: f32,
k: f32,
},
Dimension(Dimension),
Number(f64),
FontFamily(String),
FontWeight(u32),
Gradient(ResolvedGradient),
Shadow(ResolvedShadow),
Filter(ResolvedFilter),
Mask(ResolvedMask),
}Expand description
The resolved, validated value of a single design token.
Variants§
Color(String)
An sRGB-origin color, stored as canonical #rrggbb/#rrggbbaa hex.
CmykColor
A CMYK-origin color. hex is the naive device-conversion sRGB
approximation (so every existing hex consumer works unchanged); c,
m, y, k are the original percentages in 0.0..=100.0, carried so a
future PDF backend can emit native DeviceCMYK.
Dimension(Dimension)
Number(f64)
FontFamily(String)
FontWeight(u32)
Gradient(ResolvedGradient)
Shadow(ResolvedShadow)
Filter(ResolvedFilter)
Mask(ResolvedMask)
Implementations§
Source§impl ResolvedValue
impl ResolvedValue
Sourcepub fn as_color_hex(&self) -> Option<&str>
pub fn as_color_hex(&self) -> Option<&str>
The sRGB hex string for any color-origin value (Color or CmykColor),
or None for non-color values. Lets color consumers treat both color
variants uniformly without duplicating match arms.
Trait Implementations§
Source§impl Clone for ResolvedValue
impl Clone for ResolvedValue
Source§fn clone(&self) -> ResolvedValue
fn clone(&self) -> ResolvedValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedValue
impl Debug for ResolvedValue
Source§impl PartialEq for ResolvedValue
impl PartialEq for ResolvedValue
Source§fn eq(&self, other: &ResolvedValue) -> bool
fn eq(&self, other: &ResolvedValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ResolvedValue
Auto Trait Implementations§
impl Freeze for ResolvedValue
impl RefUnwindSafe for ResolvedValue
impl Send for ResolvedValue
impl Sync for ResolvedValue
impl Unpin for ResolvedValue
impl UnsafeUnpin for ResolvedValue
impl UnwindSafe for ResolvedValue
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
Mutably borrows from an owned value. Read more