pub enum Size {
Pixels(Numeric),
Percent(Numeric),
Combined(Numeric, Numeric),
}Expand description
A Size value that can be either a concrete pixel value or a percent of parent bounds.
Variants§
Implementations§
source§impl Size
impl Size
pub fn ZERO() -> 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<'de> Deserialize<'de> for Size
impl<'de> Deserialize<'de> for Size
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Size, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Size, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<IntoableLiteral> for Size
impl From<IntoableLiteral> for Size
source§fn from(value: IntoableLiteral) -> Size
fn from(value: IntoableLiteral) -> Size
Converts to this type from the input type.
source§impl Interpolatable for Size
impl Interpolatable for Size
source§impl Serialize for Size
impl Serialize for Size
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin 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, 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.