pub struct PixelValue {
pub metric: SizeMetric,
pub number: FloatValue,
}
Expand description
FloatValue, but associated with a certain metric (i.e. px, em, etc.)
Fields§
§metric: SizeMetric
§number: FloatValue
Implementations§
Source§impl PixelValue
impl PixelValue
pub const fn zero() -> Self
Sourcepub const fn const_px(value: isize) -> Self
pub const fn const_px(value: isize) -> Self
Same as PixelValue::px()
, but only accepts whole numbers,
since using f32
in const fn is not yet stabilized.
Sourcepub const fn const_em(value: isize) -> Self
pub const fn const_em(value: isize) -> Self
Same as PixelValue::em()
, but only accepts whole numbers,
since using f32
in const fn is not yet stabilized.
Sourcepub const fn const_pt(value: isize) -> Self
pub const fn const_pt(value: isize) -> Self
Same as PixelValue::pt()
, but only accepts whole numbers,
since using f32
in const fn is not yet stabilized.
Sourcepub const fn const_percent(value: isize) -> Self
pub const fn const_percent(value: isize) -> Self
Same as PixelValue::pt()
, but only accepts whole numbers,
since using f32
in const fn is not yet stabilized.
pub const fn const_from_metric(metric: SizeMetric, value: isize) -> Self
pub fn px(value: f32) -> Self
pub fn em(value: f32) -> Self
pub fn pt(value: f32) -> Self
pub fn percent(value: f32) -> Self
pub fn from_metric(metric: SizeMetric, value: f32) -> Self
Trait Implementations§
Source§impl Clone for PixelValue
impl Clone for PixelValue
Source§fn clone(&self) -> PixelValue
fn clone(&self) -> PixelValue
Returns a copy of the value. Read more
1.0.0 · 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 PixelValue
impl Debug for PixelValue
Source§impl Default for PixelValue
impl Default for PixelValue
Source§fn default() -> PixelValue
fn default() -> PixelValue
Returns the “default value” for a type. Read more
Source§impl Display for PixelValue
impl Display for PixelValue
Source§impl FormatAsCssValue for PixelValue
impl FormatAsCssValue for PixelValue
fn format_as_css_value(&self, f: &mut Formatter<'_>) -> Result
Source§impl Hash for PixelValue
impl Hash for PixelValue
Source§impl Ord for PixelValue
impl Ord for PixelValue
Source§fn cmp(&self, other: &PixelValue) -> Ordering
fn cmp(&self, other: &PixelValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PixelValue
impl PartialEq for PixelValue
Source§impl PartialOrd for PixelValue
impl PartialOrd for PixelValue
impl Copy for PixelValue
impl Eq for PixelValue
impl StructuralPartialEq for PixelValue
Auto Trait Implementations§
impl Freeze for PixelValue
impl RefUnwindSafe for PixelValue
impl Send for PixelValue
impl Sync for PixelValue
impl Unpin for PixelValue
impl UnwindSafe for PixelValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)