pub struct ReactionTerm { /* private fields */ }Expand description
A formula-backed reaction term with a stoichiometric coefficient.
Implementations§
Source§impl ReactionTerm
impl ReactionTerm
Sourcepub fn new(formula: ChemicalFormula) -> ReactionTerm
pub fn new(formula: ChemicalFormula) -> ReactionTerm
Creates a reaction term with coefficient one.
Sourcepub fn from_parts(
coefficient: StoichiometricCoefficient,
formula: ChemicalFormula,
) -> Result<ReactionTerm, ReactionValidationError>
pub fn from_parts( coefficient: StoichiometricCoefficient, formula: ChemicalFormula, ) -> Result<ReactionTerm, ReactionValidationError>
Creates a reaction term from validated parts.
§Errors
Returns ReactionValidationError::InvalidStoichiometry if the stoichiometry primitive
rejects the coefficient.
Sourcepub fn from_value(
coefficient: u32,
formula: ChemicalFormula,
) -> Result<ReactionTerm, ReactionValidationError>
pub fn from_value( coefficient: u32, formula: ChemicalFormula, ) -> Result<ReactionTerm, ReactionValidationError>
Creates a reaction term from a raw coefficient value.
§Errors
Returns ReactionValidationError::InvalidStoichiometry when coefficient is zero.
Sourcepub fn with_coefficient(
self,
coefficient: u32,
) -> Result<ReactionTerm, ReactionValidationError>
pub fn with_coefficient( self, coefficient: u32, ) -> Result<ReactionTerm, ReactionValidationError>
Returns a copy of this term with a new coefficient.
§Errors
Returns ReactionValidationError::InvalidStoichiometry when coefficient is zero.
Sourcepub const fn coefficient(&self) -> StoichiometricCoefficient
pub const fn coefficient(&self) -> StoichiometricCoefficient
Returns the stoichiometric coefficient.
Sourcepub const fn formula(&self) -> &ChemicalFormula
pub const fn formula(&self) -> &ChemicalFormula
Returns the chemical formula.
Sourcepub const fn as_stoichiometric_term(&self) -> &StoichiometricTerm
pub const fn as_stoichiometric_term(&self) -> &StoichiometricTerm
Returns the wrapped stoichiometric term.
Sourcepub fn into_stoichiometric_term(self) -> StoichiometricTerm
pub fn into_stoichiometric_term(self) -> StoichiometricTerm
Consumes this value and returns the wrapped stoichiometric term.
Sourcepub fn into_parts(self) -> (StoichiometricCoefficient, ChemicalFormula)
pub fn into_parts(self) -> (StoichiometricCoefficient, ChemicalFormula)
Consumes the term and returns its parts.
Trait Implementations§
Source§impl Clone for ReactionTerm
impl Clone for ReactionTerm
Source§fn clone(&self) -> ReactionTerm
fn clone(&self) -> ReactionTerm
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 ReactionTerm
impl Debug for ReactionTerm
Source§impl Display for ReactionTerm
impl Display for ReactionTerm
Source§impl From<ReactionTerm> for Product
impl From<ReactionTerm> for Product
Source§fn from(term: ReactionTerm) -> Product
fn from(term: ReactionTerm) -> Product
Converts to this type from the input type.
Source§impl From<ReactionTerm> for Reactant
impl From<ReactionTerm> for Reactant
Source§fn from(term: ReactionTerm) -> Reactant
fn from(term: ReactionTerm) -> Reactant
Converts to this type from the input type.
Source§impl From<StoichiometricTerm> for ReactionTerm
impl From<StoichiometricTerm> for ReactionTerm
Source§fn from(term: StoichiometricTerm) -> ReactionTerm
fn from(term: StoichiometricTerm) -> ReactionTerm
Converts to this type from the input type.
Source§impl PartialEq for ReactionTerm
impl PartialEq for ReactionTerm
impl Eq for ReactionTerm
impl StructuralPartialEq for ReactionTerm
Auto Trait Implementations§
impl Freeze for ReactionTerm
impl RefUnwindSafe for ReactionTerm
impl Send for ReactionTerm
impl Sync for ReactionTerm
impl Unpin for ReactionTerm
impl UnsafeUnpin for ReactionTerm
impl UnwindSafe for ReactionTerm
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