pub struct FormulaQuantity { /* private fields */ }Expand description
A formula with a stoichiometric quantity.
Implementations§
Source§impl FormulaQuantity
impl FormulaQuantity
Sourcepub fn new(
coefficient: StoichiometricCoefficient,
formula: ChemicalFormula,
) -> Result<Self, StoichiometryValidationError>
pub fn new( coefficient: StoichiometricCoefficient, formula: ChemicalFormula, ) -> Result<Self, StoichiometryValidationError>
Creates a formula quantity.
§Errors
Returns StoichiometryValidationError::ZeroCoefficient if the coefficient is
structurally invalid.
Sourcepub fn from_value(
coefficient: u32,
formula: ChemicalFormula,
) -> Result<Self, StoichiometryValidationError>
pub fn from_value( coefficient: u32, formula: ChemicalFormula, ) -> Result<Self, StoichiometryValidationError>
Creates a formula quantity from a raw coefficient value.
§Errors
Returns StoichiometryValidationError::ZeroCoefficient when coefficient is zero.
Sourcepub const fn coefficient(&self) -> StoichiometricCoefficient
pub const fn coefficient(&self) -> StoichiometricCoefficient
Returns the coefficient.
Sourcepub const fn formula(&self) -> &ChemicalFormula
pub const fn formula(&self) -> &ChemicalFormula
Returns the formula.
Sourcepub const fn term(&self) -> &StoichiometricTerm
pub const fn term(&self) -> &StoichiometricTerm
Returns the stoichiometric term.
Sourcepub fn into_parts(self) -> (StoichiometricCoefficient, ChemicalFormula)
pub fn into_parts(self) -> (StoichiometricCoefficient, ChemicalFormula)
Consumes the quantity and returns its parts.
Trait Implementations§
Source§impl Clone for FormulaQuantity
impl Clone for FormulaQuantity
Source§fn clone(&self) -> FormulaQuantity
fn clone(&self) -> FormulaQuantity
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 FormulaQuantity
impl Debug for FormulaQuantity
Source§impl Display for FormulaQuantity
impl Display for FormulaQuantity
Source§impl PartialEq for FormulaQuantity
impl PartialEq for FormulaQuantity
Source§fn eq(&self, other: &FormulaQuantity) -> bool
fn eq(&self, other: &FormulaQuantity) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for FormulaQuantity
impl StructuralPartialEq for FormulaQuantity
Auto Trait Implementations§
impl Freeze for FormulaQuantity
impl RefUnwindSafe for FormulaQuantity
impl Send for FormulaQuantity
impl Sync for FormulaQuantity
impl Unpin for FormulaQuantity
impl UnsafeUnpin for FormulaQuantity
impl UnwindSafe for FormulaQuantity
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