pub struct Dim {
pub pixels: f32,
pub percent: f32,
}Expand description
Describes a length consisting of one or more measurements added together.
This struct is inspired by CSS’s unit system, which is a very flexible way to talk about the size of widgets in a layout.
The equivalent CSS for a given Dim is:
calc(dim.pixels + 100 * dim.percent)where dim.pixels is the px unit in CSS and dim.percent is the % unit
in CSS.
Fields§
§pixels: f32The portion of the value in logical pixels. Works like the px unit in
CSS.
percent: f32A value scaled based on the parent object’s measurement on the axis.
1.0 corresponds to 100% of the parent width, while 0.0 corresponds
to 0%.
Implementations§
Trait Implementations§
impl Copy for Dim
impl StructuralPartialEq for Dim
Auto Trait Implementations§
impl Freeze for Dim
impl RefUnwindSafe for Dim
impl Send for Dim
impl Sync for Dim
impl Unpin for Dim
impl UnwindSafe for Dim
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