#[non_exhaustive]pub enum Length {
Show 17 variants
Parsec,
LightYear,
AstronomicalUnit,
NauticalMile,
Kilometer,
Meter,
Decimeter,
Centimeter,
Millimeter,
Micrometer,
Nanometer,
Angstrom,
Picometer,
Mile,
Yard,
Foot,
Inch,
}Expand description
A unit of length.
The listed abbreviations are the abbreviations used to parse the unit with
FromStr. The main abbreviation comes first, followed by any alternate
abbreviations that can be used.
The conversions are listed in terms of the base unit. The base unit for
Length is Length::Meter.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parsec
-
Abbreviation:
pc -
1 pc = 3.085677581e16 m
LightYear
-
Abbreviation:
ly -
1 ly = 9.4607304725808e15 m
AstronomicalUnit
-
Abbreviation:
au -
1 au = 1.495978707e11 m
NauticalMile
-
Abbreviation:
nmi -
1 nmi = 1852.0 m
Kilometer
-
Abbreviation:
km -
1 km = 1000.0 m
Meter
-
Abbreviation:
m -
1 m = 1.0 m
Decimeter
-
Abbreviation:
dm -
1 dm = 0.1 m
Centimeter
-
Abbreviation:
cm -
1 cm = 0.01 m
Millimeter
-
Abbreviation:
mm -
1 mm = 0.001 m
Micrometer
-
Abbreviation:
µm,um -
1 µm = 1e-6 m
Nanometer
-
Abbreviation:
nm -
1 nm = 1e-9 m
Angstrom
-
Abbreviation:
Å,A -
1 Å = 1e-10 m
Picometer
-
Abbreviation:
pm -
1 pm = 1e-12 m
Mile
-
Abbreviation:
mi -
1 mi = 1609.344 m
Yard
-
Abbreviation:
yd -
1 yd = 0.9144 m
Foot
-
Abbreviation:
ft -
1 ft = 0.3048 m
Inch
-
Abbreviation:
in -
1 in = 0.0254 m
Implementations§
Trait Implementations§
Source§impl Convert for Length
impl Convert for Length
Source§fn conversion_factor(&self) -> f64
fn conversion_factor(&self) -> f64
&self to Convert::BASE, i.e. the value to multiply
a quantity in this unit by, in order to get a quantity in Convert::BASE. If the self
unit is the same as this unit, then this function should return 1.0. Read moreSource§fn conversion_factor_to(&self, _: impl Into<Unit>) -> Option<f64>
fn conversion_factor_to(&self, _: impl Into<Unit>) -> Option<f64>
Convert::BASE, to a base unit that Convert::BASE
is derived from. Returns None if there is no conversion factor, meaning the two units
are unrelated. Read more