pub struct MolarMass { /* private fields */ }Expand description
A positive finite molar mass value with an associated display unit.
Implementations§
Source§impl MolarMass
impl MolarMass
Sourcepub fn new(
value: f64,
unit: MolarMassUnit,
) -> Result<MolarMass, MolarMassValidationError>
pub fn new( value: f64, unit: MolarMassUnit, ) -> Result<MolarMass, MolarMassValidationError>
Creates a molar mass value in the requested unit.
§Errors
Returns MolarMassValidationError::NonFiniteMolarMass when value is
not finite, or MolarMassValidationError::NonPositiveMolarMass when it
is zero or negative.
Sourcepub fn grams_per_mole(value: f64) -> Result<MolarMass, MolarMassValidationError>
pub fn grams_per_mole(value: f64) -> Result<MolarMass, MolarMassValidationError>
Creates a molar mass in grams per mole.
§Errors
Returns a molar-mass validation error when value is not finite and positive.
Sourcepub fn kilograms_per_mole(
value: f64,
) -> Result<MolarMass, MolarMassValidationError>
pub fn kilograms_per_mole( value: f64, ) -> Result<MolarMass, MolarMassValidationError>
Creates a molar mass in kilograms per mole.
§Errors
Returns a molar-mass validation error when value is not finite and positive.
Sourcepub const fn unit(self) -> MolarMassUnit
pub const fn unit(self) -> MolarMassUnit
Returns the molar mass display unit.
Trait Implementations§
Source§impl PartialOrd for MolarMass
impl PartialOrd for MolarMass
impl Copy for MolarMass
impl StructuralPartialEq for MolarMass
Auto Trait Implementations§
impl Freeze for MolarMass
impl RefUnwindSafe for MolarMass
impl Send for MolarMass
impl Sync for MolarMass
impl Unpin for MolarMass
impl UnsafeUnpin for MolarMass
impl UnwindSafe for MolarMass
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