pub enum Length {
Pixel(f32),
Percent(f32),
}Expand description
A length along one axis: absolute in pixels, or a fraction of the parent’s
content area in percent. Passed to width and
height.
Constructed with the constructor methods:
Length::pixel— an absolute size in pixels; participates in animation (viaover) and in the parent’s natural size;Length::percent— a fraction of the parent in percent (100.0— 100%,50.0— half); resolved on the second layout pass relative to the parent and overrides the pixel size. The fraction itself is not animated.
let full = Shape::rect().width(Length::percent(100.0)); // the parent's full width
let fixed = Shape::rect().width(Length::pixel(120.0)); // exactly 120 pxVariants§
Pixel(f32)
An absolute size in pixels.
Percent(f32)
A fraction of the parent’s content area in percent (100.0 — 100%).
Implementations§
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