#[repr(C, u8)]pub enum PixelValueOrSystem {
Value(PixelValue),
System(SystemMetricRef),
}Expand description
A pixel value reference that can be either a concrete value or a system metric. System metrics are lazily evaluated at runtime based on the user’s system theme.
CSS syntax: 10px, 1.5em, system:button-padding, etc.
Variants§
Value(PixelValue)
A concrete pixel value.
System(SystemMetricRef)
A reference to a system metric, resolved at runtime.
Implementations§
Source§impl PixelValueOrSystem
impl PixelValueOrSystem
Sourcepub const fn value(v: PixelValue) -> Self
pub const fn value(v: PixelValue) -> Self
Create a new PixelValueOrSystem from a concrete value.
Sourcepub const fn system(s: SystemMetricRef) -> Self
pub const fn system(s: SystemMetricRef) -> Self
Create a new PixelValueOrSystem from a system metric reference.
Sourcepub fn resolve(
&self,
system_metrics: &SystemMetrics,
fallback: PixelValue,
) -> PixelValue
pub fn resolve( &self, system_metrics: &SystemMetrics, fallback: PixelValue, ) -> PixelValue
Resolve the pixel value against a SystemMetrics struct. Returns the system metric if available, or falls back to the provided default.
Trait Implementations§
Source§impl Clone for PixelValueOrSystem
impl Clone for PixelValueOrSystem
Source§fn clone(&self) -> PixelValueOrSystem
fn clone(&self) -> PixelValueOrSystem
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 PixelValueOrSystem
impl Debug for PixelValueOrSystem
Source§impl Default for PixelValueOrSystem
impl Default for PixelValueOrSystem
Source§impl Display for PixelValueOrSystem
impl Display for PixelValueOrSystem
Source§impl FormatAsCssValue for PixelValueOrSystem
impl FormatAsCssValue for PixelValueOrSystem
fn format_as_css_value(&self, f: &mut Formatter<'_>) -> Result
Source§impl From<PixelValue> for PixelValueOrSystem
impl From<PixelValue> for PixelValueOrSystem
Source§fn from(value: PixelValue) -> Self
fn from(value: PixelValue) -> Self
Converts to this type from the input type.
Source§impl PartialEq for PixelValueOrSystem
impl PartialEq for PixelValueOrSystem
Source§fn eq(&self, other: &PixelValueOrSystem) -> bool
fn eq(&self, other: &PixelValueOrSystem) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PixelValueOrSystem
impl PartialOrd for PixelValueOrSystem
impl Copy for PixelValueOrSystem
impl StructuralPartialEq for PixelValueOrSystem
Auto Trait Implementations§
impl Freeze for PixelValueOrSystem
impl RefUnwindSafe for PixelValueOrSystem
impl Send for PixelValueOrSystem
impl Sync for PixelValueOrSystem
impl Unpin for PixelValueOrSystem
impl UnsafeUnpin for PixelValueOrSystem
impl UnwindSafe for PixelValueOrSystem
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