pub struct ElementMassContribution { /* private fields */ }Expand description
A per-element contribution to a formula molar mass.
Implementations§
Source§impl ElementMassContribution
impl ElementMassContribution
Sourcepub fn new(
symbol: &str,
atomic_mass: f64,
count: u32,
) -> Result<Self, MolarMassValidationError>
pub fn new( symbol: &str, atomic_mass: f64, count: u32, ) -> Result<Self, MolarMassValidationError>
Creates an element mass contribution.
§Errors
Returns a molar-mass validation error when the symbol, atomic mass, count, or calculated contribution is invalid.
Sourcepub const fn atomic_mass(&self) -> f64
pub const fn atomic_mass(&self) -> f64
Returns the atomic mass in grams per mole.
Sourcepub fn total_mass_value(&self) -> f64
pub fn total_mass_value(&self) -> f64
Returns the contribution value in grams per mole.
Sourcepub fn total_molar_mass(&self) -> Result<MolarMass, MolarMassValidationError>
pub fn total_molar_mass(&self) -> Result<MolarMass, MolarMassValidationError>
Returns the contribution as a molar mass value in grams per mole.
§Errors
Returns a molar-mass validation error if the calculated contribution is invalid.
Trait Implementations§
Source§impl Clone for ElementMassContribution
impl Clone for ElementMassContribution
Source§fn clone(&self) -> ElementMassContribution
fn clone(&self) -> ElementMassContribution
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ElementMassContribution
impl Debug for ElementMassContribution
Source§impl Display for ElementMassContribution
impl Display for ElementMassContribution
Source§impl PartialEq for ElementMassContribution
impl PartialEq for ElementMassContribution
Source§fn eq(&self, other: &ElementMassContribution) -> bool
fn eq(&self, other: &ElementMassContribution) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ElementMassContribution
Auto Trait Implementations§
impl Freeze for ElementMassContribution
impl RefUnwindSafe for ElementMassContribution
impl Send for ElementMassContribution
impl Sync for ElementMassContribution
impl Unpin for ElementMassContribution
impl UnsafeUnpin for ElementMassContribution
impl UnwindSafe for ElementMassContribution
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