Enum LengthValue
pub enum LengthValue {
}
Expand description
A length value.
Variants§
Px(f32)
Pixels.
A pixel is the smallest viewable unit. The length of a pixel depends on the used device.
In(f32)
Inches.
An inch is roughly 96 pixels or about 2.54cm.
Cm(f32)
Centimeters.
A centimeter is roughly 37.8 pixels.
Mm(f32)
Millimeters.
A millimeter is roughly 3.78 pixels or 1/10th of a centimeter.
Q(f32)
Quarter.
A quarter of a millimeter is roughly 1/40th of 1cm.
Pt(f32)
Points.
A point is roughly 1.3333 pixels or 1/72th of an inch.
Pc(f32)
Picas.
A pica is roughly 16 pixels or 1/6th of an inch.
Em(f32)
em.
An em is equal to the computed font-size
property of the element on which it is used.
Ex(f32)
ex.
An ex is the height of the letter x
of the font, or 0.5em.
Ch(f32)
Character unit.
A character unit is defined as the width of the character 0
of the font.
Rem(f32)
Root em.
An rem is equal to the computed font-size
property of the root of the document.
For websites the root of the document is the <html>
element.
Vw(f32)
View width.
A length equal to 1% of the width of the viewport.
Vh(f32)
View height.
A length equal to 1% of the height of the viewport.
Vmin(f32)
Viewport minimum.
A viewport minimum is equal to 1% of the viewport’s smallest dimension. For example 1vmin is equal to 6px on a browser window that is 1200px wide and 600px high.
Vmax(f32)
Viewport maximum.
A viewport maximum is equal to 1% of the viewport’s largest dimension. For example 1vmax is equal to 12px on a browser window that is 1200px wide and 600px high.
Implementations§
§impl LengthValue
impl LengthValue
pub fn to_unit_value(&self) -> (f32, &str)
Trait Implementations§
§impl Clone for LengthValue
impl Clone for LengthValue
§fn clone(&self) -> LengthValue
fn clone(&self) -> LengthValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for LengthValue
impl Debug for LengthValue
§impl Default for LengthValue
impl Default for LengthValue
§fn default() -> LengthValue
fn default() -> LengthValue
§impl From<LengthValue> for LengthOrPercentage
impl From<LengthValue> for LengthOrPercentage
§fn from(value: LengthValue) -> LengthOrPercentage
fn from(value: LengthValue) -> LengthOrPercentage
§impl Mul<f32> for LengthValue
impl Mul<f32> for LengthValue
§type Output = LengthValue
type Output = LengthValue
*
operator.§fn mul(self, other: f32) -> LengthValue
fn mul(self, other: f32) -> LengthValue
*
operation. Read more§impl<'i> Parse<'i> for LengthValue
impl<'i> Parse<'i> for LengthValue
fn parse<'t>( input: &mut Parser<'i, 't>, ) -> Result<LengthValue, ParseError<'i, CustomParseError<'i>>>
§impl PartialEq<f32> for LengthValue
impl PartialEq<f32> for LengthValue
§impl PartialEq for LengthValue
impl PartialEq for LengthValue
§impl PartialOrd<f32> for LengthValue
impl PartialOrd<f32> for LengthValue
§impl PartialOrd for LengthValue
impl PartialOrd for LengthValue
§impl Res<LengthValue> for LengthValue
impl Res<LengthValue> for LengthValue
§impl ResGet<LengthValue> for LengthValue
impl ResGet<LengthValue> for LengthValue
fn get_ref<'a>( &self, _: &impl DataContext, ) -> Option<LensValue<'_, LengthValue>>
fn get(&self, _: &impl DataContext) -> LengthValue
§impl TryAdd<LengthValue> for LengthValue
impl TryAdd<LengthValue> for LengthValue
fn try_add(&self, other: &LengthValue) -> Option<LengthValue>
impl Copy for LengthValue
impl StructuralPartialEq for LengthValue
Auto Trait Implementations§
impl Freeze for LengthValue
impl RefUnwindSafe for LengthValue
impl Send for LengthValue
impl Sync for LengthValue
impl Unpin for LengthValue
impl UnwindSafe for LengthValue
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.