Struct measurements::Length [] [src]

pub struct Length {
    // some fields omitted
}

The Length struct can be used to deal with lengths in a common way. Common metric and imperial units are supported.

Example

use measurements::Length;
 
let football_field = Length::from_yards(100.0);
let meters = football_field.as_meters();
println!("There are {} meters in a football field.", meters);

Methods

impl Length
[src]

fn from_meters(meters: f64) -> Self

fn from_nanometers(nanometers: f64) -> Self

fn from_micrometers(micrometers: f64) -> Self

fn from_millimeters(millimeters: f64) -> Self

fn from_centimeters(centimeters: f64) -> Self

fn from_decameters(decameters: f64) -> Self

fn from_hectometers(hectometers: f64) -> Self

fn from_kilometers(kilometers: f64) -> Self

fn from_inches(inches: f64) -> Self

fn from_feet(feet: f64) -> Self

fn from_yards(yards: f64) -> Self

fn from_furlongs(furlongs: f64) -> Self

fn from_miles(miles: f64) -> Self

fn as_nanometers(&self) -> f64

fn as_micrometers(&self) -> f64

fn as_millimeters(&self) -> f64

fn as_centimeters(&self) -> f64

fn as_meters(&self) -> f64

fn as_decameters(&self) -> f64

fn as_hectometer(&self) -> f64

fn as_kilometers(&self) -> f64

fn as_inches(&self) -> f64

fn as_feet(&self) -> f64

fn as_yards(&self) -> f64

fn as_furlongs(&self) -> f64

fn as_miles(&self) -> f64

Trait Implementations

impl Debug for Length
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Length
[src]

fn clone(&self) -> Length

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Copy for Length
[src]

impl Measurement for Length
[src]

fn get_base_units(&self) -> f64

fn from_base_units(units: f64) -> Self

impl Add for Length
[src]

type Output = Self

The resulting type after applying the + operator

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

The method for the + operator

impl Sub for Length
[src]

type Output = Self

The resulting type after applying the - operator

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

The method for the - operator

impl Div<Length> for Length
[src]

Dividing a $t by another $ returns a ratio.

type Output = f64

The resulting type after applying the / operator

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

The method for the / operator

impl Div<f64> for Length
[src]

Dividing a $ by a factor returns a new portion of the measurement.

type Output = Self

The resulting type after applying the / operator

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

The method for the / operator

impl Mul<Length> for Length
[src]

Multiplying a $t by another $t returns the product of those measurements.

type Output = Self

The resulting type after applying the * operator

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

The method for the * operator

impl Mul<f64> for Length
[src]

Multiplying a $t by a factor increases (or decreases) that measurement a number of times.

type Output = Self

The resulting type after applying the * operator

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

The method for the * operator

impl Eq for Length
[src]

impl PartialEq for Length
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl PartialOrd for Length
[src]

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

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

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

This method tests less than (for self and other) and is used by the < operator. Read more

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

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

This method tests greater than (for self and other) and is used by the > operator. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more