pub enum LengthUnit {
Tabs,
Ems,
Points,
Millimeters,
Centimeters,
Inches,
}Expand description
The unit of a Length: one of a closed set, spelled tab, em, pt,
mm, cm and in (LengthUnit::as_str).
See the module documentation for what each unit measures, the point in particular; in short, a tab is the unit each backend sets the width of.
Variants§
Tabs
A tab, tab: the width each backend sets through one setting of its
own.
Ems
An em, em: the width of an em in the current font.
Points
A point, pt (see the module documentation).
Millimeters
A millimeter, mm.
Centimeters
A centimeter, cm.
Inches
An inch, in.
Implementations§
Source§impl LengthUnit
impl LengthUnit
Sourcepub const ALL: [LengthUnit; 6]
pub const ALL: [LengthUnit; 6]
Every unit, in declaration order.
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The unit’s stable name, as a length is written and projected: tab,
em, pt, mm, cm or in.
Sourcepub fn parse(name: &str) -> Option<LengthUnit>
pub fn parse(name: &str) -> Option<LengthUnit>
The unit of a stable name, if any.
Sourcepub fn is_physical(self) -> bool
pub fn is_physical(self) -> bool
Whether the unit has a fixed size — pt, mm, cm or in, the
units a length converts among (see the
module documentation).
A tab and an em are not physical.
Trait Implementations§
Source§impl Clone for LengthUnit
impl Clone for LengthUnit
impl Copy for LengthUnit
Source§impl Debug for LengthUnit
impl Debug for LengthUnit
Source§impl Display for LengthUnit
impl Display for LengthUnit
impl Eq for LengthUnit
Source§impl Hash for LengthUnit
impl Hash for LengthUnit
Source§impl PartialEq for LengthUnit
impl PartialEq for LengthUnit
impl StructuralPartialEq for LengthUnit
Auto Trait Implementations§
impl Forget for LengthUnit
impl Freeze for LengthUnit
impl Move 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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 more