pub struct Temperature(/* private fields */);Expand description
A temperature quantity, stored canonically in kelvin (K).
Celsius and Fahrenheit conversions use offset formulas, not simple scale factors. Addition and subtraction operate on raw kelvin values.
§Construction
use space_units::Temperature;
let t = Temperature::from_c(20.0);Implementations§
Source§impl Temperature
impl Temperature
Sourcepub const fn from_c(val: f64) -> Self
pub const fn from_c(val: f64) -> Self
Create from degrees Celsius (degC) – applies +273.15 offset.
Sourcepub const fn from_f(val: f64) -> Self
pub const fn from_f(val: f64) -> Self
Create from degrees Fahrenheit (degF) – applies offset conversion.
Sourcepub const fn display_as(self, unit: TemperatureUnit) -> DisplayWithUnit
pub const fn display_as(self, unit: TemperatureUnit) -> DisplayWithUnit
Return a display wrapper that formats this temperature in the given unit.
Trait Implementations§
Source§impl Add for Temperature
impl Add for Temperature
Source§impl AddAssign for Temperature
impl AddAssign for Temperature
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
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 Default for Temperature
impl Default for Temperature
Source§fn default() -> Temperature
fn default() -> Temperature
Returns the “default value” for a type. Read more
Source§impl Display for Temperature
impl Display for Temperature
Source§impl Div<f64> for Temperature
impl Div<f64> for Temperature
Source§impl Div for Temperature
impl Div for Temperature
Source§impl DivAssign<f64> for Temperature
impl DivAssign<f64> for Temperature
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/= operation. Read moreSource§impl Mul<Temperature> for f64
impl Mul<Temperature> for f64
Source§type Output = Temperature
type Output = Temperature
The resulting type after applying the
* operator.Source§fn mul(self, rhs: Temperature) -> Temperature
fn mul(self, rhs: Temperature) -> Temperature
Performs the
* operation. Read moreSource§impl Mul<f64> for Temperature
impl Mul<f64> for Temperature
Source§impl MulAssign<f64> for Temperature
impl MulAssign<f64> for Temperature
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*= operation. Read moreSource§impl Neg for Temperature
impl Neg 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§impl SubAssign for Temperature
impl SubAssign for Temperature
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl Sum for Temperature
impl Sum 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 UnsafeUnpin 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