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