Struct Ion
pub struct Ion { /* private fields */ }Expand description
A charged atom or charged group represented by formula and charge.
Implementations§
§impl Ion
impl Ion
pub fn new(formula: ChemicalFormula, charge: IonCharge) -> Ion
pub fn new(formula: ChemicalFormula, charge: IonCharge) -> Ion
Creates an ion from a parsed formula and validated charge.
pub fn formula(&self) -> &ChemicalFormula
pub fn formula(&self) -> &ChemicalFormula
Returns the chemical formula.
pub const fn ion_formula(&self) -> &IonFormula
pub const fn ion_formula(&self) -> &IonFormula
Returns the ion formula wrapper.
pub fn oxidation_state_label(&self) -> Option<&str>
pub fn oxidation_state_label(&self) -> Option<&str>
Returns the optional oxidation-state label.
pub fn try_with_name(self, name: &str) -> Result<Ion, IonValidationError>
pub fn try_with_name(self, name: &str) -> Result<Ion, IonValidationError>
Sets the ion name after validation.
§Errors
Returns IonValidationError::EmptyName when name is empty after trimming.
pub fn with_oxidation_state_label(self, label: String) -> Ion
pub fn with_oxidation_state_label(self, label: String) -> Ion
Sets the oxidation-state label from a prevalidated value.
pub fn try_with_oxidation_state_label(
self,
label: &str,
) -> Result<Ion, IonValidationError>
pub fn try_with_oxidation_state_label( self, label: &str, ) -> Result<Ion, IonValidationError>
Sets the oxidation-state label after validation.
§Errors
Returns IonValidationError::EmptyOxidationStateLabel when label is empty after trimming.
Trait Implementations§
impl Eq for Ion
impl StructuralPartialEq for Ion
Auto Trait Implementations§
impl Freeze for Ion
impl RefUnwindSafe for Ion
impl Send for Ion
impl Sync for Ion
impl Unpin for Ion
impl UnsafeUnpin for Ion
impl UnwindSafe for Ion
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