#[repr(u8)]pub enum LengthUnit {
Show 50 variants
Px = 0,
In = 1,
Cm = 2,
Mm = 3,
Q = 4,
Pt = 5,
Pc = 6,
Em = 7,
Ex = 8,
Rex = 9,
Ch = 10,
Rch = 11,
Cap = 12,
Rcap = 13,
Ic = 14,
Ric = 15,
Rem = 16,
Lh = 17,
Rlh = 18,
Vw = 19,
Svw = 20,
Lvw = 21,
Dvw = 22,
Vh = 23,
Svh = 24,
Lvh = 25,
Dvh = 26,
Vmin = 27,
Svmin = 28,
Lvmin = 29,
Dvmin = 30,
Vmax = 31,
Svmax = 32,
Lvmax = 33,
Dvmax = 34,
Vb = 35,
Svb = 36,
Lvb = 37,
Dvb = 38,
Vi = 39,
Svi = 40,
Lvi = 41,
Dvi = 42,
Cqw = 43,
Cqh = 44,
Cqi = 45,
Cqb = 46,
Cqmin = 47,
Cqmax = 48,
ServoCharacterWidth = 49,
}Expand description
The unit of a <length> value. Note that if any new font-relative value is
added here, custom_properties::NonCustomReferences::from_unit
must also be updated. Consult the comment in that function as to why.
The variants are grouped (absolute, font-relative, viewport, container,
servo-internal) so that is_* predicates can be implemented with simple
range checks.
Variants§
Px = 0
In = 1
Cm = 2
Mm = 3
Q = 4
Pt = 5
Pc = 6
Em = 7
Ex = 8
Rex = 9
Ch = 10
Rch = 11
Cap = 12
Rcap = 13
Ic = 14
Ric = 15
Rem = 16
Lh = 17
Rlh = 18
Vw = 19
Svw = 20
Lvw = 21
Dvw = 22
Vh = 23
Svh = 24
Lvh = 25
Dvh = 26
Vmin = 27
Svmin = 28
Lvmin = 29
Dvmin = 30
Vmax = 31
Svmax = 32
Lvmax = 33
Dvmax = 34
Vb = 35
Svb = 36
Lvb = 37
Dvb = 38
Vi = 39
Svi = 40
Lvi = 41
Dvi = 42
Cqw = 43
Cqh = 44
Cqi = 45
Cqb = 46
Cqmin = 47
Cqmax = 48
ServoCharacterWidth = 49
HTML5 “character width”, as defined in HTML5 § 14.5.4. Internal-only.
Implementations§
Source§impl LengthUnit
impl LengthUnit
Sourcepub fn is_absolute(self) -> bool
pub fn is_absolute(self) -> bool
Whether this is an absolute length unit (px, in, cm, mm, q, pt, pc).
Sourcepub fn is_font_relative(self) -> bool
pub fn is_font_relative(self) -> bool
Whether this is a font-relative unit.
Sourcepub fn is_viewport_percentage(self) -> bool
pub fn is_viewport_percentage(self) -> bool
Whether this is a viewport-percentage unit.
Sourcepub fn is_container_relative(self) -> bool
pub fn is_container_relative(self) -> bool
Whether this is a container-relative unit.
Trait Implementations§
Source§impl Clone for LengthUnit
impl Clone for LengthUnit
Source§fn clone(&self) -> LengthUnit
fn clone(&self) -> LengthUnit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LengthUnit
impl Debug for LengthUnit
Source§impl MallocSizeOf for LengthUnit
impl MallocSizeOf for LengthUnit
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Source§impl PartialEq for LengthUnit
impl PartialEq for LengthUnit
Source§impl PartialOrd for LengthUnit
impl PartialOrd for LengthUnit
Source§impl ToShmem for LengthUnit
impl ToShmem for LengthUnit
impl Copy for LengthUnit
impl Eq for LengthUnit
impl StructuralPartialEq for LengthUnit
Auto Trait Implementations§
impl Freeze for LengthUnit
impl RefUnwindSafe for LengthUnit
impl Send for LengthUnit
impl Sync for LengthUnit
impl Unpin for LengthUnit
impl UnsafeUnpin for LengthUnit
impl UnwindSafe for LengthUnit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert