pub struct Cation(/* private fields */);Expand description
A positive ion wrapper.
Implementations§
Source§impl Cation
impl Cation
Sourcepub fn new(
formula: ChemicalFormula,
magnitude: u8,
) -> Result<Self, IonValidationError>
pub fn new( formula: ChemicalFormula, magnitude: u8, ) -> Result<Self, IonValidationError>
Creates a cation from a formula and positive charge magnitude.
§Errors
Returns IonValidationError::ZeroChargeMagnitude when magnitude is zero.
Sourcepub fn from_ion(ion: Ion) -> Result<Self, IonValidationError>
pub fn from_ion(ion: Ion) -> Result<Self, IonValidationError>
Wraps an existing positive ion.
§Errors
Returns IonValidationError::ExpectedCation when ion has a negative charge.
Trait Implementations§
impl Eq for Cation
impl StructuralPartialEq for Cation
Auto Trait Implementations§
impl Freeze for Cation
impl RefUnwindSafe for Cation
impl Send for Cation
impl Sync for Cation
impl Unpin for Cation
impl UnsafeUnpin for Cation
impl UnwindSafe for Cation
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