pub struct Length { /* private fields */ }Expand description
A CSS length: a numeric value paired with a LengthUnit.
Construct one with a per-unit helper like Length::px or Length::rem,
or from a value and unit with Length::new. Plain numbers convert to a
pixel length, so a #[into] component parameter accepts size: 24 as a
24-pixel length.
Implementations§
Source§impl Length
impl Length
Sourcepub const fn new(value: f32, unit: LengthUnit) -> Self
pub const fn new(value: f32, unit: LengthUnit) -> Self
Creates a length from a numeric value and a unit.
Sourcepub const fn unit(self) -> LengthUnit
pub const fn unit(self) -> LengthUnit
Returns the unit of this length.
Trait Implementations§
Source§impl AttributeValueViewParts for Length
impl AttributeValueViewParts for Length
Source§fn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Returns whether the containing attribute should be rendered. Read more
Source§fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
Appends this attribute value to the view being built.
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