Struct runtime_units::Length

source ·
pub struct Length {
    pub value: f64,
    pub unit: LengthUnit,
}
Expand description

Length (base unit meter, m).

Fields§

§value: f64§unit: LengthUnit

Implementations§

source§

impl Length

source

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

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 to_quantity(&self) -> Quantity

Create a Quantity from this Length.

Trait Implementations§

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 From<Length> for LengthQuantity

source§

fn from(quantity: 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 PartialEq for Length

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Length

source§

impl StructuralPartialEq for Length

Auto Trait Implementations§

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> 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,

§

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>,

§

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>,

§

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.