pub enum LayoutLength {
Fraction(f32),
Px(f32),
Percent(f32),
}Expand description
A layout length that may be a percent: a size or an inset side.
Variants§
Fraction(f32)
A fraction of the layout picture’s shorter side, written as a number.
Px(f32)
Pixels of the project canvas, written "<n>px". A plan converts it to a fraction of the
canvas’s shorter side.
Percent(f32)
Percent (0 to 100) of the parent’s content box along the field’s axis, written "<n>%".
Implementations§
Source§impl LayoutLength
impl LayoutLength
Sourcepub fn in_bounds(self) -> bool
pub fn in_bounds(self) -> bool
Whether the number is finite and within its unit’s bound: MAX_LAYOUT_FRACTION,
MAX_LAYOUT_PX or MAX_LAYOUT_PERCENT.
Sourcepub const fn is_percent(self) -> bool
pub const fn is_percent(self) -> bool
Whether it is a percent.
Sourcepub fn without_px(self, shorter_side: f32) -> Self
pub fn without_px(self, shorter_side: f32) -> Self
The same length with pixels converted to a fraction of a picture shorter_side pixels on
its shorter side.
Sourcepub const fn with_value(self, value: f32) -> Self
pub const fn with_value(self, value: f32) -> Self
The same kind of length with value.
Trait Implementations§
Source§impl AnimatedValue for LayoutLength
impl AnimatedValue for LayoutLength
Source§const ACCEPTS_DATA: bool = false
const ACCEPTS_DATA: bool = false
Whether the type takes the
data value mode.Source§impl Clone for LayoutLength
impl Clone for LayoutLength
impl Copy for LayoutLength
Source§impl Debug for LayoutLength
impl Debug for LayoutLength
Source§impl Default for LayoutLength
impl Default for LayoutLength
Source§impl<'de> Deserialize<'de> for LayoutLength
impl<'de> Deserialize<'de> for LayoutLength
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for LayoutLength
impl Display for LayoutLength
Source§impl PartialEq for LayoutLength
impl PartialEq for LayoutLength
Source§impl Serialize for LayoutLength
impl Serialize for LayoutLength
impl StructuralPartialEq for LayoutLength
Auto Trait Implementations§
impl Forget for LayoutLength
impl Freeze for LayoutLength
impl Move for LayoutLength
impl RefUnwindSafe for LayoutLength
impl Send for LayoutLength
impl Sync for LayoutLength
impl Unpin for LayoutLength
impl UnsafeUnpin for LayoutLength
impl UnwindSafe for LayoutLength
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