Struct Length

Source
pub struct Length { /* private fields */ }
Expand description

Length (base UnitDefinition meter, m). Scalar storage of a quantity (f64 and LengthUnit).

Implementations§

Source§

impl Length

Source

pub fn new(value: f64, unit: LengthUnit) -> Self

Create a new LengthUnit.

Source

pub fn yottameter(value: f64) -> Self

Create a new Length with units of LengthUnit::yottameter.

Source

pub fn zettameter(value: f64) -> Self

Create a new Length with units of LengthUnit::zettameter.

Source

pub fn exameter(value: f64) -> Self

Create a new Length with units of LengthUnit::exameter.

Source

pub fn petameter(value: f64) -> Self

Create a new Length with units of LengthUnit::petameter.

Source

pub fn terameter(value: f64) -> Self

Create a new Length with units of LengthUnit::terameter.

Source

pub fn gigameter(value: f64) -> Self

Create a new Length with units of LengthUnit::gigameter.

Source

pub fn megameter(value: f64) -> Self

Create a new Length with units of LengthUnit::megameter.

Source

pub fn kilometer(value: f64) -> Self

Create a new Length with units of LengthUnit::kilometer.

Source

pub fn hectometer(value: f64) -> Self

Create a new Length with units of LengthUnit::hectometer.

Source

pub fn decameter(value: f64) -> Self

Create a new Length with units of LengthUnit::decameter.

Source

pub fn meter(value: f64) -> Self

Create a new Length with units of LengthUnit::meter.

Source

pub fn decimeter(value: f64) -> Self

Create a new Length with units of LengthUnit::decimeter.

Source

pub fn centimeter(value: f64) -> Self

Create a new Length with units of LengthUnit::centimeter.

Source

pub fn millimeter(value: f64) -> Self

Create a new Length with units of LengthUnit::millimeter.

Source

pub fn micrometer(value: f64) -> Self

Create a new Length with units of LengthUnit::micrometer.

Source

pub fn nanometer(value: f64) -> Self

Create a new Length with units of LengthUnit::nanometer.

Source

pub fn picometer(value: f64) -> Self

Create a new Length with units of LengthUnit::picometer.

Source

pub fn femtometer(value: f64) -> Self

Create a new Length with units of LengthUnit::femtometer.

Source

pub fn attometer(value: f64) -> Self

Create a new Length with units of LengthUnit::attometer.

Source

pub fn zeptometer(value: f64) -> Self

Create a new Length with units of LengthUnit::zeptometer.

Source

pub fn yoctometer(value: f64) -> Self

Create a new Length with units of LengthUnit::yoctometer.

Source

pub fn angstrom(value: f64) -> Self

Create a new Length with units of LengthUnit::angstrom.

Source

pub fn bohr_radius(value: f64) -> Self

Create a new Length with units of LengthUnit::bohr_radius.

Source

pub fn atomic_unit_of_length(value: f64) -> Self

Create a new Length with units of LengthUnit::atomic_unit_of_length.

Source

pub fn astronomical_unit(value: f64) -> Self

Create a new Length with units of LengthUnit::astronomical_unit.

Source

pub fn chain(value: f64) -> Self

Create a new Length with units of LengthUnit::chain.

Source

pub fn fathom(value: f64) -> Self

Create a new Length with units of LengthUnit::fathom.

Source

pub fn fermi(value: f64) -> Self

Create a new Length with units of LengthUnit::fermi.

Source

pub fn foot(value: f64) -> Self

Create a new Length with units of LengthUnit::foot.

Source

pub fn kilofoot(value: f64) -> Self

Create a new Length with units of LengthUnit::kilofoot.

Source

pub fn foot_survey(value: f64) -> Self

Create a new Length with units of LengthUnit::foot_survey.

Source

pub fn inch(value: f64) -> Self

Create a new Length with units of LengthUnit::inch.

Source

pub fn light_year(value: f64) -> Self

Create a new Length with units of LengthUnit::light_year.

Source

pub fn microinch(value: f64) -> Self

Create a new Length with units of LengthUnit::microinch.

Source

pub fn micron(value: f64) -> Self

Create a new Length with units of LengthUnit::micron.

Source

pub fn mil(value: f64) -> Self

Create a new Length with units of LengthUnit::mil.

Source

pub fn mile(value: f64) -> Self

Create a new Length with units of LengthUnit::mile.

Source

pub fn mile_survey(value: f64) -> Self

Create a new Length with units of LengthUnit::mile_survey.

Source

pub fn nautical_mile(value: f64) -> Self

Create a new Length with units of LengthUnit::nautical_mile.

Source

pub fn parsec(value: f64) -> Self

Create a new Length with units of LengthUnit::parsec.

Source

pub fn pica_computer(value: f64) -> Self

Create a new Length with units of LengthUnit::pica_computer.

Source

pub fn pica_printers(value: f64) -> Self

Create a new Length with units of LengthUnit::pica_printers.

Source

pub fn point_computer(value: f64) -> Self

Create a new Length with units of LengthUnit::point_computer.

Source

pub fn point_printers(value: f64) -> Self

Create a new Length with units of LengthUnit::point_printers.

Source

pub fn rod(value: f64) -> Self

Create a new Length with units of LengthUnit::rod.

Source

pub fn yard(value: f64) -> Self

Create a new Length with units of LengthUnit::yard.

Source

pub fn value(&self) -> f64

Retrieve the value associated with this Length.

Source

pub fn value_mut(&mut self) -> &mut f64

Retrieve the mutable value associated with this Length.

Source

pub fn definition(&self) -> UnitDefinition

Retrieve the UnitDefinition associated with this Length.

Source

pub fn to_yottameter(&self) -> Self

Source

pub fn to_zettameter(&self) -> Self

Source

pub fn to_exameter(&self) -> Self

Source

pub fn to_petameter(&self) -> Self

Source

pub fn to_terameter(&self) -> Self

Source

pub fn to_gigameter(&self) -> Self

Source

pub fn to_megameter(&self) -> Self

Source

pub fn to_kilometer(&self) -> Self

Source

pub fn to_hectometer(&self) -> Self

Source

pub fn to_decameter(&self) -> Self

Source

pub fn to_meter(&self) -> Self

Convert to LengthUnit::meter.

Source

pub fn to_decimeter(&self) -> Self

Source

pub fn to_centimeter(&self) -> Self

Source

pub fn to_millimeter(&self) -> Self

Source

pub fn to_micrometer(&self) -> Self

Source

pub fn to_nanometer(&self) -> Self

Source

pub fn to_picometer(&self) -> Self

Source

pub fn to_femtometer(&self) -> Self

Source

pub fn to_attometer(&self) -> Self

Source

pub fn to_zeptometer(&self) -> Self

Source

pub fn to_yoctometer(&self) -> Self

Source

pub fn to_angstrom(&self) -> Self

Source

pub fn to_bohr_radius(&self) -> Self

Source

pub fn to_atomic_unit_of_length(&self) -> Self

Source

pub fn to_astronomical_unit(&self) -> Self

Source

pub fn to_chain(&self) -> Self

Convert to LengthUnit::chain.

Source

pub fn to_fathom(&self) -> Self

Convert to LengthUnit::fathom.

Source

pub fn to_fermi(&self) -> Self

Convert to LengthUnit::fermi.

Source

pub fn to_foot(&self) -> Self

Convert to LengthUnit::foot.

Source

pub fn to_kilofoot(&self) -> Self

Source

pub fn to_foot_survey(&self) -> Self

Source

pub fn to_inch(&self) -> Self

Convert to LengthUnit::inch.

Source

pub fn to_light_year(&self) -> Self

Source

pub fn to_microinch(&self) -> Self

Source

pub fn to_micron(&self) -> Self

Convert to LengthUnit::micron.

Source

pub fn to_mil(&self) -> Self

Convert to LengthUnit::mil.

Source

pub fn to_mile(&self) -> Self

Convert to LengthUnit::mile.

Source

pub fn to_mile_survey(&self) -> Self

Source

pub fn to_nautical_mile(&self) -> Self

Source

pub fn to_parsec(&self) -> Self

Convert to LengthUnit::parsec.

Source

pub fn to_pica_computer(&self) -> Self

Source

pub fn to_pica_printers(&self) -> Self

Source

pub fn to_point_computer(&self) -> Self

Source

pub fn to_point_printers(&self) -> Self

Source

pub fn to_rod(&self) -> Self

Convert to LengthUnit::rod.

Source

pub fn to_yard(&self) -> Self

Convert to LengthUnit::yard.

Trait Implementations§

Source§

impl Add<Quantity> for Length

Source§

type Output = Length

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Quantity) -> Self

Performs the + operation. Read more
Source§

impl Add for Length

Source§

type Output = Length

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Length) -> Self

Performs the + operation. Read more
Source§

impl AddAssign<Quantity> for Length

Source§

fn add_assign(&mut self, rhs: Quantity)

Performs the += operation. Read more
Source§

impl AddAssign for Length

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Length

Source§

fn clone(&self) -> Length

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Length

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Length

Source§

fn default() -> Length

Returns the “default value” for a type. Read more
Source§

impl<T: IsScalarQuantity> Div<T> for Length

Source§

type Output = Quantity

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Quantity

Performs the / operation. Read more
Source§

impl Div<f64> for Length

Source§

type Output = Length

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<f64> for Length

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl FixedQuantity<LengthUnit> for Length

Source§

fn unit(&self) -> LengthUnit

Return unit associated with this quantity
Source§

fn convert(&self, unit: LengthUnit) -> Self

Convert from this unit to another (creates a copy). No validation of base unit is made.
Source§

fn convert_mut(&mut self, unit: LengthUnit)

Convert from this unit to another (modifies current quantity). No validation of base unit is made.
Source§

fn unit_mut(&mut self) -> &mut LengthUnit

Return mutable unit associated with this quantity
Source§

fn try_convert(&self, unit: Units) -> Result<Self, RuntimeUnitError>
where Self: Sized,

Try to convert from this unit to another (creates a copy)
Source§

impl From<&Length> for Units

Source§

fn from(value: &Length) -> Self

Converts to this type from the input type.
Source§

impl From<Length> for Quantity

Source§

fn from(quantity: Length) -> Self

Converts to this type from the input type.
Source§

impl From<Length> for UnitDefinition

Source§

fn from(value: Length) -> Self

Converts to this type from the input type.
Source§

impl From<Length> for Units

Source§

fn from(value: Length) -> Self

Converts to this type from the input type.
Source§

impl From<Quantity> for Length

Source§

fn from(quantity: Quantity) -> Length

Converts to this type from the input type.
Source§

impl<T: IsScalarQuantity> Mul<T> for Length

Source§

type Output = Quantity

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Quantity

Performs the * operation. Read more
Source§

impl Mul<f64> for Length

Source§

type Output = Length

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f64> for Length

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl PartialEq<Length> for Quantity

Source§

fn eq(&self, other: &Length) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Quantity> for Length

Source§

fn eq(&self, other: &Quantity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Length

Source§

fn eq(&self, other: &Length) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Length

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<Quantity> for Length

Source§

type Output = Length

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Quantity) -> Self

Performs the - operation. Read more
Source§

impl Sub for Length

Source§

type Output = Length

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Length) -> Self

Performs the - operation. Read more
Source§

impl SubAssign<Quantity> for Length

Source§

fn sub_assign(&mut self, rhs: Quantity)

Performs the -= operation. Read more
Source§

impl SubAssign for Length

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Copy for Length

Auto Trait Implementations§

§

impl Freeze for Length

§

impl RefUnwindSafe for Length

§

impl Send for Length

§

impl Sync for Length

§

impl Unpin for Length

§

impl UnwindSafe for Length

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.