Struct measurements::temperature::TemperatureDelta
source · [−]pub struct TemperatureDelta { /* private fields */ }
Expand description
The TemperatureDelta
struct can be used to deal with differences between
temperatures in a common way.
Example
use measurements::{Temperature, TemperatureDelta};
let boiling_water = Temperature::from_celsius(100.0);
let frozen_water = Temperature::from_celsius(0.0);
let difference: TemperatureDelta = boiling_water - frozen_water;
println!("Boiling water is {} above freezing.", difference);
Implementations
sourceimpl TemperatureDelta
impl TemperatureDelta
sourcepub fn from_kelvin(kelvin_degrees: f64) -> Self
pub fn from_kelvin(kelvin_degrees: f64) -> Self
Create a new TemperatureDelta from a floating point value in Kelvin
sourcepub fn from_celsius(celsius_degrees: f64) -> Self
pub fn from_celsius(celsius_degrees: f64) -> Self
Create a new TemperatureDelta from a floating point value in Celsius
sourcepub fn from_fahrenheit(farenheit_degrees: f64) -> Self
pub fn from_fahrenheit(farenheit_degrees: f64) -> Self
Create a new TemperatureDelta from a floating point value in Fahrenheit
sourcepub fn from_rankine(rankine_degrees: f64) -> Self
pub fn from_rankine(rankine_degrees: f64) -> Self
Create a new TemperatureDelta from a floating point value in Rankine
sourcepub fn as_kelvin(&self) -> f64
pub fn as_kelvin(&self) -> f64
Convert this TemperatureDelta to a floating point value in Kelvin
sourcepub fn as_celsius(&self) -> f64
pub fn as_celsius(&self) -> f64
Convert this TemperatureDelta to a floating point value in Celsius
sourcepub fn as_fahrenheit(&self) -> f64
pub fn as_fahrenheit(&self) -> f64
Convert this TemperatureDelta to a floating point value in Fahrenheit
sourcepub fn as_rankine(&self) -> f64
pub fn as_rankine(&self) -> f64
Convert this TemperatureDelta to a floating point value in Rankine
Trait Implementations
sourceimpl Add<Temperature> for TemperatureDelta
impl Add<Temperature> for TemperatureDelta
type Output = Temperature
type Output = Temperature
The resulting type after applying the +
operator.
sourcefn add(self, other: Temperature) -> Temperature
fn add(self, other: Temperature) -> Temperature
Performs the +
operation. Read more
sourceimpl Add<TemperatureDelta> for Temperature
impl Add<TemperatureDelta> for Temperature
type Output = Temperature
type Output = Temperature
The resulting type after applying the +
operator.
sourcefn add(self, other: TemperatureDelta) -> Temperature
fn add(self, other: TemperatureDelta) -> Temperature
Performs the +
operation. Read more
sourceimpl Add<TemperatureDelta> for TemperatureDelta
impl Add<TemperatureDelta> for TemperatureDelta
sourceimpl Clone for TemperatureDelta
impl Clone for TemperatureDelta
sourcefn clone(&self) -> TemperatureDelta
fn clone(&self) -> TemperatureDelta
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TemperatureDelta
impl Debug for TemperatureDelta
sourceimpl Display for TemperatureDelta
impl Display for TemperatureDelta
sourceimpl Div<TemperatureDelta> for TemperatureDelta
impl Div<TemperatureDelta> for TemperatureDelta
sourceimpl Div<f64> for TemperatureDelta
impl Div<f64> for TemperatureDelta
sourceimpl Measurement for TemperatureDelta
impl Measurement for TemperatureDelta
sourcefn as_base_units(&self) -> f64
fn as_base_units(&self) -> f64
Get this quantity in the base units
sourcefn from_base_units(kelvin_degrees: f64) -> Self
fn from_base_units(kelvin_degrees: f64) -> Self
Create a new quantity from the base units
sourcefn get_base_units_name(&self) -> &'static str
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example “kilograms” Read more
sourcefn get_appropriate_units(&self) -> (&'static str, f64)
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
sourceimpl Mul<TemperatureDelta> for f64
impl Mul<TemperatureDelta> for f64
type Output = TemperatureDelta
type Output = TemperatureDelta
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: TemperatureDelta) -> TemperatureDelta
fn mul(self, rhs: TemperatureDelta) -> TemperatureDelta
Performs the *
operation. Read more
sourceimpl Mul<f64> for TemperatureDelta
impl Mul<f64> for TemperatureDelta
sourceimpl PartialEq<TemperatureDelta> for TemperatureDelta
impl PartialEq<TemperatureDelta> for TemperatureDelta
sourceimpl PartialOrd<TemperatureDelta> for TemperatureDelta
impl PartialOrd<TemperatureDelta> for TemperatureDelta
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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
sourceimpl Sub<TemperatureDelta> for Temperature
impl Sub<TemperatureDelta> for Temperature
type Output = Temperature
type Output = Temperature
The resulting type after applying the -
operator.
sourcefn sub(self, other: TemperatureDelta) -> Temperature
fn sub(self, other: TemperatureDelta) -> Temperature
Performs the -
operation. Read more
sourceimpl Sub<TemperatureDelta> for TemperatureDelta
impl Sub<TemperatureDelta> for TemperatureDelta
impl Copy for TemperatureDelta
impl Eq for TemperatureDelta
Auto Trait Implementations
impl RefUnwindSafe for TemperatureDelta
impl Send for TemperatureDelta
impl Sync for TemperatureDelta
impl Unpin for TemperatureDelta
impl UnwindSafe for TemperatureDelta
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more