pub enum Length {
Px(f32),
Percent(f32),
Auto,
}Expand description
A length in a layout attribute.
Percent holds a fraction, like taffy: Length::Percent(0.5) is 50%.
The From<&str> impl parses the CSS-ish spellings ("50%", "auto",
"12px", "12").
Variants§
Px(f32)
An absolute length in egui points.
Percent(f32)
A fraction of the containing block (0.5 is 50%).
Auto
Sized by the layout algorithm.
Implementations§
Source§impl Length
impl Length
Sourcepub fn to_dimension(self) -> Dimension
pub fn to_dimension(self) -> Dimension
As a taffy Dimension (width / height / flex-basis).
Sourcepub fn to_length_percentage_auto(self) -> LengthPercentageAuto
pub fn to_length_percentage_auto(self) -> LengthPercentageAuto
As a taffy LengthPercentageAuto (margin).
Sourcepub fn to_length_percentage(self) -> LengthPercentage
pub fn to_length_percentage(self) -> LengthPercentage
As a taffy LengthPercentage (padding). Auto becomes zero.
Trait Implementations§
impl Copy for Length
impl StructuralPartialEq for Length
Auto Trait Implementations§
impl Freeze for Length
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnsafeUnpin for Length
impl UnwindSafe for Length
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more