pub enum Size {
Pixels(Numeric),
Percent(Numeric),
Combined(Numeric, Numeric),
}Expand description
A spatial size value that can be either a concrete pixel value like 25px, a percent of parent bounds like 50%,
or an additive/subtractive combination of the two like (100% - 10px).
Variants§
Pixels(Numeric)
Concrete pixel length, such as 25px.
Percent(Numeric)
Percent length relative to the relevant parent bound, such as 50%.
Combined(Numeric, Numeric)
Additive pixel and percent components, such as 100% - 10px.
Implementations§
Source§impl Size
impl Size
Sourcepub fn expect_percent(&self) -> f64
pub fn expect_percent(&self) -> f64
Returns the wrapped percent value normalized as a float, such that 100% => 1.0. Panics if wrapped type is not a percentage.
Sourcepub fn expect_pixels(&self) -> Numeric
pub fn expect_pixels(&self) -> Numeric
Returns the pixel value Panics if wrapped type is not pixels.
Trait Implementations§
Source§impl CoercionRules for Size
impl CoercionRules for Size
impl Copy for Size
Source§impl<'de> Deserialize<'de> for Size
impl<'de> Deserialize<'de> for Size
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl HelperFunctions for Size
impl HelperFunctions for Size
Source§fn register_all_functions()
fn register_all_functions()
Registers all helper functions for this type.
Source§impl Interpolatable for Size
impl Interpolatable for Size
Source§fn interpolate(&self, other: &Self, t: f64) -> Self
fn interpolate(&self, other: &Self, t: f64) -> Self
impl StructuralPartialEq for Size
Source§impl ToPaxValue for Size
impl ToPaxValue for Size
Source§fn to_pax_value(self) -> PaxValue
fn to_pax_value(self) -> PaxValue
Converts this value into a
PaxValue.Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnsafeUnpin for Size
impl UnwindSafe for Size
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> PropertyValue for T
Source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.