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]
impl Temperature
pub fn from_kelvin(degrees_kelvin: f64) -> Self
[src]
pub fn from_kelvin(degrees_kelvin: f64) -> Self
Create a new Temperature from a floating point value in Kelvin
pub fn from_celsius(degrees_celsius: f64) -> Self
[src]
pub fn from_celsius(degrees_celsius: f64) -> Self
Create a new Temperature from a floating point value in Celsius
pub fn from_fahrenheit(degrees_fahrenheit: f64) -> Self
[src]
pub fn from_fahrenheit(degrees_fahrenheit: f64) -> Self
Create a new Temperature from a floating point value in Fahrenheit
pub fn from_rankine(degrees_rankine: f64) -> Self
[src]
pub fn from_rankine(degrees_rankine: f64) -> Self
Create a new Temperature from a floating point value in Rankine
pub fn as_kelvin(&self) -> f64
[src]
pub fn as_kelvin(&self) -> f64
Convert this absolute Temperature to a floating point value in Kelvin
pub fn as_celsius(&self) -> f64
[src]
pub fn as_celsius(&self) -> f64
Convert this absolute Temperature to a floating point value in Celsius
pub fn as_fahrenheit(&self) -> f64
[src]
pub fn as_fahrenheit(&self) -> f64
Convert this absolute Temperature to a floating point value in Fahrenheit
pub fn as_rankine(&self) -> f64
[src]
pub fn as_rankine(&self) -> f64
Convert this absolute Temperature to a floating point value in Rankine
Trait Implementations
impl Copy for Temperature
[src]
impl Copy for Temperature
impl Clone for Temperature
[src]
impl Clone for Temperature
fn clone(&self) -> Temperature
[src]
fn clone(&self) -> Temperature
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Temperature
[src]
impl Debug for Temperature
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Measurement for Temperature
[src]
impl Measurement for Temperature
fn as_base_units(&self) -> f64
[src]
fn as_base_units(&self) -> f64
Get this quantity in the base units
fn from_base_units(degrees_kelvin: f64) -> Self
[src]
fn from_base_units(degrees_kelvin: f64) -> Self
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
fn get_appropriate_units(&self) -> (&'static str, f64)
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]
fn pick_appropriate_units(
&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]
impl Add<TemperatureDelta> for Temperature
type Output = Temperature
The resulting type after applying the +
operator.
fn add(self, other: TemperatureDelta) -> Temperature
[src]
fn add(self, other: TemperatureDelta) -> Temperature
Performs the +
operation.
impl Add<Temperature> for TemperatureDelta
[src]
impl Add<Temperature> for TemperatureDelta
type Output = Temperature
The resulting type after applying the +
operator.
fn add(self, other: Temperature) -> Temperature
[src]
fn add(self, other: Temperature) -> Temperature
Performs the +
operation.
impl Sub<TemperatureDelta> for Temperature
[src]
impl Sub<TemperatureDelta> for Temperature
type Output = Temperature
The resulting type after applying the -
operator.
fn sub(self, other: TemperatureDelta) -> Temperature
[src]
fn sub(self, other: TemperatureDelta) -> Temperature
Performs the -
operation.
impl Sub<Temperature> for Temperature
[src]
impl Sub<Temperature> for Temperature
type Output = TemperatureDelta
The resulting type after applying the -
operator.
fn sub(self, other: Temperature) -> TemperatureDelta
[src]
fn sub(self, other: Temperature) -> TemperatureDelta
Performs the -
operation.
impl Eq for Temperature
[src]
impl Eq for Temperature
impl PartialEq for Temperature
[src]
impl PartialEq for Temperature
fn eq(&self, other: &Self) -> bool
[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[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialOrd for Temperature
[src]
impl PartialOrd for Temperature
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[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[src]
fn lt(&self, other: &Rhs) -> bool
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]
fn le(&self, other: &Rhs) -> bool
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]
fn gt(&self, other: &Rhs) -> bool
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]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Display for Temperature
[src]
impl Display for Temperature
Auto Trait Implementations
impl Send for Temperature
impl Send for Temperature
impl Sync for Temperature
impl Sync for Temperature