Struct measurements::Temperature [] [src]

pub struct Temperature {
    // some fields omitted
}

The Temperature struct can be used to deal with temperatures in a common way.

Example

use measurements::Temperature;
 
let boiling_water = Temperature::from_celsius(100.0);
let fahrenheit = boiling_water.as_fahrenheit();
println!("Boiling water measures at {} degrees fahrenheit.", fahrenheit);

Methods

impl Temperature
[src]

fn from_kelvin(kelvin: f64) -> Self

fn from_celsius(celsius: f64) -> Self

fn from_fahrenheit(fahrenheit: f64) -> Self

fn from_rankine(rankine: f64) -> Self

fn as_kelvin(&self) -> f64

fn as_celsius(&self) -> f64

fn as_fahrenheit(&self) -> f64

fn as_rankine(&self) -> f64

Trait Implementations

impl Debug for Temperature
[src]

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

Formats the value using the given formatter.

impl Clone for Temperature
[src]

fn clone(&self) -> Temperature

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 Temperature
[src]

impl Measurement for Temperature
[src]

fn get_base_units(&self) -> f64

fn from_base_units(units: f64) -> Self

impl Add for Temperature
[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 Temperature
[src]

type Output = Self

The resulting type after applying the - operator

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

The method for the - operator

impl Div<Temperature> for Temperature
[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 Temperature
[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<Temperature> for Temperature
[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 Temperature
[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 Temperature
[src]

impl PartialEq for Temperature
[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 Temperature
[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