pub struct Dimension<T = u32> {
pub amount: T,
pub unit: DimensionUnit,
}Expand description
A measurement of screen space, specified as a pixel amount, a percentage, or an amount of
character widths, as determined by the DimensionUnit.
Fields§
§amount: T§unit: DimensionUnitImplementations§
Source§impl<T> Dimension<T>
impl<T> Dimension<T>
Sourcepub const fn pixels(amount: T) -> Self
pub const fn pixels(amount: T) -> Self
Constructs a Dimension for the specified amount in pixels (DimensionUnit::Pixel).
Sourcepub const fn character_spacing(amount: T) -> Self
pub const fn character_spacing(amount: T) -> Self
Constructs a Dimension for the specified amount in character spacing
(DimensionUnit::CharacterSpacing).
Sourcepub const fn percentage(amount: T) -> Self
pub const fn percentage(amount: T) -> Self
Constructs a Dimension for the specified amount in screen percentage
(DimensionUnit::Percentage).
Trait Implementations§
impl<T: Copy> Copy for Dimension<T>
impl<T: Eq> Eq for Dimension<T>
impl<T> StructuralPartialEq for Dimension<T>
Auto Trait Implementations§
impl<T> Freeze for Dimension<T>where
T: Freeze,
impl<T> RefUnwindSafe for Dimension<T>where
T: RefUnwindSafe,
impl<T> Send for Dimension<T>where
T: Send,
impl<T> Sync for Dimension<T>where
T: Sync,
impl<T> Unpin for Dimension<T>where
T: Unpin,
impl<T> UnsafeUnpin for Dimension<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Dimension<T>where
T: UnwindSafe,
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