pub enum LengthUnit {
Show 23 variants
Unitless,
Inch,
Foot,
Mile,
Millimeter,
Centimeter,
Meter,
Kilometer,
Microinch,
Mil,
Yard,
Angstrom,
Nanometer,
Micrometer,
Decimeter,
Decameter,
Hectometer,
Gigameter,
AstronomicalUnit,
LightYear,
Parsec,
UsSurveyFoot,
Custom,
}Expand description
Length unit. Mirrors the DWG $INSUNITS set.
Variants§
Unitless
Inch
Foot
Mile
Millimeter
Centimeter
Meter
Kilometer
Microinch
Mil
Yard
Angstrom
Nanometer
Micrometer
Decimeter
Decameter
Hectometer
Gigameter
AstronomicalUnit
LightYear
Parsec
UsSurveyFoot
Custom
A unit that is not in this list; see Units::meters_per_unit.
Implementations§
Source§impl LengthUnit
impl LengthUnit
Sourcepub fn meters(self) -> Option<f64>
pub fn meters(self) -> Option<f64>
Size of one unit in meters; None for LengthUnit::Unitless and LengthUnit::Custom.
Sourcepub fn from_insunits(code: i32) -> Self
pub fn from_insunits(code: i32) -> Self
Maps a DWG/DXF $INSUNITS value to a unit. Unknown codes give LengthUnit::Unitless.
Sourcepub fn to_insunits(self) -> i32
pub fn to_insunits(self) -> i32
The $INSUNITS code of this unit (0 for unitless and custom units).
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 Default for LengthUnit
impl Default for LengthUnit
Source§impl<'de> Deserialize<'de> for LengthUnit
impl<'de> Deserialize<'de> for LengthUnit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for LengthUnit
Source§impl Hash for LengthUnit
impl Hash for LengthUnit
Source§impl PartialEq for LengthUnit
impl PartialEq for LengthUnit
Source§impl Serialize for LengthUnit
impl Serialize 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
Mutably borrows from an owned value. Read more