Struct mendeleev::KiloJoulePerMole
source · pub struct KiloJoulePerMole(pub f64);
Expand description
A value in kilojoules per mole (kJ/mol).
Basic arithmetic is implemented for convenience, and the underlying f64 value is accessible as a tuple field.
Example
use mendeleev::KiloJoulePerMole;
use core::cmp::Ordering;
let value1 = KiloJoulePerMole(1.0);
let value2 = KiloJoulePerMole(2.0);
assert_eq!(value1.0, 1.0);
assert!(value1 < value2);
assert_eq!(value1.total_cmp(&value2), Ordering::Less);
assert_eq!(value1 + value2, KiloJoulePerMole(3.0));
assert_eq!(value1 - value2, KiloJoulePerMole(-1.0));
assert_eq!(value1 * 5.0, KiloJoulePerMole(5.0));
assert_eq!(value1 / 4.0, KiloJoulePerMole(0.25));
Tuple Fields§
§0: f64
Implementations§
source§impl KiloJoulePerMole
impl KiloJoulePerMole
sourcepub fn total_cmp(&self, other: &Self) -> Ordering
pub fn total_cmp(&self, other: &Self) -> Ordering
Return the ordering between self
and other
.
This simply calls f64::total_cmp
on the inner value.
Trait Implementations§
source§impl Add<KiloJoulePerMole> for KiloJoulePerMole
impl Add<KiloJoulePerMole> for KiloJoulePerMole
source§impl Clone for KiloJoulePerMole
impl Clone for KiloJoulePerMole
source§fn clone(&self) -> KiloJoulePerMole
fn clone(&self) -> KiloJoulePerMole
Returns a copy 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 KiloJoulePerMole
impl Debug for KiloJoulePerMole
source§impl Display for KiloJoulePerMole
impl Display for KiloJoulePerMole
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Displays the value along with the unit. Supports numeric formatting.
A space is added between the number and the unit, in accordance with the SI convention.
Example
use mendeleev::KiloJoulePerMole;
let value = KiloJoulePerMole(1.2345);
assert_eq!(format!("{value:.1}"), "1.2 kJ/mol");
source§impl Div<f64> for KiloJoulePerMole
impl Div<f64> for KiloJoulePerMole
source§impl Mul<f64> for KiloJoulePerMole
impl Mul<f64> for KiloJoulePerMole
source§impl PartialEq<KiloJoulePerMole> for KiloJoulePerMole
impl PartialEq<KiloJoulePerMole> for KiloJoulePerMole
source§fn eq(&self, other: &KiloJoulePerMole) -> bool
fn eq(&self, other: &KiloJoulePerMole) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<KiloJoulePerMole> for KiloJoulePerMole
impl PartialOrd<KiloJoulePerMole> for KiloJoulePerMole
source§fn partial_cmp(&self, other: &KiloJoulePerMole) -> Option<Ordering>
fn partial_cmp(&self, other: &KiloJoulePerMole) -> Option<Ordering>
1.0.0 · source§fn 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 moresource§impl Sub<KiloJoulePerMole> for KiloJoulePerMole
impl Sub<KiloJoulePerMole> for KiloJoulePerMole
impl Copy for KiloJoulePerMole
impl StructuralPartialEq for KiloJoulePerMole
Auto Trait Implementations§
impl RefUnwindSafe for KiloJoulePerMole
impl Send for KiloJoulePerMole
impl Sync for KiloJoulePerMole
impl Unpin for KiloJoulePerMole
impl UnwindSafe for KiloJoulePerMole
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