pub enum Temperature {
Fahrenheit(f32),
Celsius(f32),
Kelvin(f32),
}Expand description
A Temperature type from simmer.
A value that’s one of many common temperature units.
Wraps a floating point number to give it a unit!
You can create a new Temperature by putting a float value inside.
Important: Temperature is not checked, so invalid states are
completely allowed.
ⓘ
use simmer::Temperature;
let my_temp = Temperature::Celsius(0.0);Variants§
Implementations§
Source§impl Temperature
impl Temperature
Sourcepub fn to_fahrenheit(&self) -> Temperature
pub fn to_fahrenheit(&self) -> Temperature
Sourcepub fn to_celsius(&self) -> Temperature
pub fn to_celsius(&self) -> Temperature
Sourcepub fn to_kelvin(&self) -> Temperature
pub fn to_kelvin(&self) -> Temperature
Sourcepub fn into_inner(self) -> f32
pub fn into_inner(self) -> f32
Sourcepub fn is_below_abs_zero(&self) -> bool
pub fn is_below_abs_zero(&self) -> bool
Tells you if a Temperature is below absolute zero - an invalid state for temperature.
So… returns:
trueift>= abs zerofalseift< abs zero
§Usage
ⓘ
let temp = Temperature::Kelvin(0.0);
assert!(!temp.is_below_abs_zero());
let temp2 = Temperature::Kelvin(-0.1);
assert!(temp2.is_below_abs_zero());Trait Implementations§
Source§impl Add for Temperature
impl Add for Temperature
Source§type Output = Temperature
type Output = Temperature
The resulting type after applying the
+ operator.Source§fn add(self, rhs: Temperature) -> <Temperature as Add>::Output
fn add(self, rhs: Temperature) -> <Temperature as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for Temperature
impl Clone for Temperature
Source§fn clone(&self) -> Temperature
fn clone(&self) -> Temperature
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Temperature
impl Debug for Temperature
Source§impl Display for Temperature
impl Display for Temperature
Source§impl Div<f32> for Temperature
impl Div<f32> for Temperature
Source§impl Into<f32> for Temperature
impl Into<f32> for Temperature
Source§impl Mul<f32> for Temperature
impl Mul<f32> for Temperature
Source§impl PartialEq for Temperature
impl PartialEq for Temperature
Source§impl PartialOrd for Temperature
impl PartialOrd for Temperature
Source§impl Sub for Temperature
impl Sub for Temperature
Source§type Output = Temperature
type Output = Temperature
The resulting type after applying the
- operator.Source§fn sub(self, rhs: Temperature) -> <Temperature as Sub>::Output
fn sub(self, rhs: Temperature) -> <Temperature as Sub>::Output
Performs the
- operation. Read moreSource§impl uDebug for Temperature
impl uDebug for Temperature
Source§impl uDisplay for Temperature
impl uDisplay for Temperature
impl Copy for Temperature
impl StructuralPartialEq for Temperature
Auto Trait Implementations§
impl Freeze for Temperature
impl RefUnwindSafe for Temperature
impl Send for Temperature
impl Sync for Temperature
impl Unpin for Temperature
impl UnwindSafe for Temperature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more