Struct measurements::temperature::Temperature
[−]
[src]
pub struct Temperature { /* fields omitted */ }
The Temperature
struct can be used to deal with absolute 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]
pub fn from_kelvin(degrees_kelvin: f64) -> Self
[src]
Create a new Temperature from a floating point value in Kelvin
pub fn from_celsius(degrees_celsius: f64) -> Self
[src]
Create a new Temperature from a floating point value in Celsius
pub fn from_fahrenheit(degrees_fahrenheit: f64) -> Self
[src]
Create a new Temperature from a floating point value in Fahrenheit
pub fn from_rankine(degrees_rankine: f64) -> Self
[src]
Create a new Temperature from a floating point value in Rankine
pub fn as_kelvin(&self) -> f64
[src]
Convert this absolute Temperature to a floating point value in Kelvin
pub fn as_celsius(&self) -> f64
[src]
Convert this absolute Temperature to a floating point value in Celsius
pub fn as_fahrenheit(&self) -> f64
[src]
Convert this absolute Temperature to a floating point value in Fahrenheit
pub fn as_rankine(&self) -> f64
[src]
Convert this absolute Temperature to a floating point value in Rankine
Trait Implementations
impl Copy for Temperature
[src]
impl Clone for Temperature
[src]
fn clone(&self) -> Temperature
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Temperature
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Measurement for Temperature
[src]
fn as_base_units(&self) -> f64
[src]
Get this quantity in the base units
fn from_base_units(degrees_kelvin: f64) -> Self
[src]
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
Returns a string containing the most appropriate units for this quantity, and a floating point value representing this quantity in those units. Useful when, for example, a length might be in millimeters if it is very small, or kilometers when it is very large. Read more
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
[src]
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
Given a list of units and their scale relative to the base unit, select the most appropriate one. Read more
impl Add<TemperatureDelta> for Temperature
[src]
type Output = Temperature
The resulting type after applying the +
operator.
fn add(self, other: TemperatureDelta) -> Temperature
[src]
Performs the +
operation.
impl Add<Temperature> for TemperatureDelta
[src]
type Output = Temperature
The resulting type after applying the +
operator.
fn add(self, other: Temperature) -> Temperature
[src]
Performs the +
operation.
impl Sub<TemperatureDelta> for Temperature
[src]
type Output = Temperature
The resulting type after applying the -
operator.
fn sub(self, other: TemperatureDelta) -> Temperature
[src]
Performs the -
operation.
impl Sub<Temperature> for Temperature
[src]
type Output = TemperatureDelta
The resulting type after applying the -
operator.
fn sub(self, other: Temperature) -> TemperatureDelta
[src]
Performs the -
operation.
impl Eq for Temperature
[src]
impl PartialEq for Temperature
[src]
fn eq(&self, other: &Self) -> bool
[src]
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[src]
This method tests for !=
.
impl PartialOrd for Temperature
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
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[src]
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[src]
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[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more