Struct sensehat::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) -> Temperature
[src]
pub fn from_kelvin(degrees_kelvin: f64) -> Temperature
Create a new Temperature from a floating point value in Kelvin
pub fn from_celsius(degrees_celsius: f64) -> Temperature
[src]
pub fn from_celsius(degrees_celsius: f64) -> Temperature
Create a new Temperature from a floating point value in Celsius
pub fn from_fahrenheit(degrees_fahrenheit: f64) -> Temperature
[src]
pub fn from_fahrenheit(degrees_fahrenheit: f64) -> Temperature
Create a new Temperature from a floating point value in Fahrenheit
pub fn from_rankine(degrees_rankine: f64) -> Temperature
[src]
pub fn from_rankine(degrees_rankine: f64) -> Temperature
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 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 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 PartialOrd<Temperature> for Temperature
[src]
impl PartialOrd<Temperature> for Temperature
fn partial_cmp(&self, other: &Temperature) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Temperature) -> 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 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 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 Display for Temperature
[src]
impl Display for Temperature
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
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<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Copy for Temperature
[src]
impl Copy for Temperature
impl Eq for Temperature
[src]
impl Eq for Temperature
impl PartialEq<Temperature> for Temperature
[src]
impl PartialEq<Temperature> for Temperature
fn eq(&self, other: &Temperature) -> bool
[src]
fn eq(&self, other: &Temperature) -> 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 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) -> Temperature
[src]
fn from_base_units(degrees_kelvin: f64) -> Temperature
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
Auto Trait Implementations
impl Send for Temperature
impl Send for Temperature
impl Sync for Temperature
impl Sync for Temperature