pub struct Temperature(/* private fields */);Expand description
Absolute Temperature (Kelvin).
Implementations§
Source§impl Temperature
impl Temperature
Sourcepub fn new(val: f64) -> Result<Self, PhysicsError>
pub fn new(val: f64) -> Result<Self, PhysicsError>
Creates a new Temperature instance from Kelvin.
§Errors
Returns PhysicsError::ZeroKelvinViolation if val < 0.0.
Sourcepub fn from_celsius(celsius: f64) -> Result<Self, PhysicsError>
pub fn from_celsius(celsius: f64) -> Result<Self, PhysicsError>
Creates a new Temperature instance from Celsius.
§Errors
Returns PhysicsError::ZeroKelvinViolation if val < -273.15.
Sourcepub fn from_fahrenheit(fahrenheit: f64) -> Result<Self, PhysicsError>
pub fn from_fahrenheit(fahrenheit: f64) -> Result<Self, PhysicsError>
Creates a new Temperature instance from Fahrenheit.
§Errors
Returns PhysicsError::ZeroKelvinViolation if val < -459.67.
Sourcepub fn new_unchecked(val: f64) -> Self
pub fn new_unchecked(val: f64) -> Self
Creates a new Temperature instance without validation.
Sourcepub fn as_celsius(&self) -> f64
pub fn as_celsius(&self) -> f64
Returns the temperature in Celsius.
Sourcepub fn as_fahrenheit(&self) -> f64
pub fn as_fahrenheit(&self) -> f64
Returns the temperature in Fahrenheit.
Trait Implementations§
Source§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 From<Temperature> for f64
impl From<Temperature> for f64
Source§fn from(val: Temperature) -> Self
fn from(val: Temperature) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Temperature
impl PartialEq for Temperature
Source§impl PartialOrd for Temperature
impl PartialOrd 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