Struct Isotope
pub struct Isotope { /* private fields */ }Expand description
Small validated isotope identity.
Implementations§
§impl Isotope
impl Isotope
pub const fn new(atomic_number: u8, mass_number: u16) -> Option<Isotope>
pub const fn new(atomic_number: u8, mass_number: u16) -> Option<Isotope>
Creates an isotope identity from an atomic number and mass number.
Validation is structural: the atomic number must be in the element range, and the mass number must be at least the atomic number. This does not imply that the isotope is naturally occurring, stable, or experimentally known.
§Examples
use use_isotope::Isotope;
let carbon_12 = Isotope::new(6, 12).unwrap();
assert_eq!(carbon_12.atomic_number(), 6);
assert_eq!(carbon_12.mass_number(), 12);pub fn from_symbol(symbol: &str, mass_number: u16) -> Option<Isotope>
pub fn from_symbol(symbol: &str, mass_number: u16) -> Option<Isotope>
Creates an isotope identity from an element symbol and mass number.
pub const fn atomic_number(&self) -> u8
pub const fn atomic_number(&self) -> u8
Returns the isotope atomic number.
pub const fn mass_number(&self) -> u16
pub const fn mass_number(&self) -> u16
Returns the isotope mass number.
pub const fn proton_count(&self) -> u8
pub const fn proton_count(&self) -> u8
Returns the proton count.
pub const fn neutron_count(&self) -> u16
pub const fn neutron_count(&self) -> u16
Returns the neutron count.
pub const fn nucleon_count(&self) -> u16
pub const fn nucleon_count(&self) -> u16
Returns the nucleon count.
pub fn element_symbol(&self) -> Option<&'static str>
pub fn element_symbol(&self) -> Option<&'static str>
Looks up the isotope element symbol.
pub fn element_name(&self) -> Option<&'static str>
pub fn element_name(&self) -> Option<&'static str>
Looks up the isotope element name.
pub fn hyphen_notation(&self) -> Option<String>
pub fn hyphen_notation(&self) -> Option<String>
Formats the isotope with ASCII hyphen notation, such as C-12.
Trait Implementations§
impl Copy for Isotope
impl Eq for Isotope
impl StructuralPartialEq for Isotope
Auto Trait Implementations§
impl Freeze for Isotope
impl RefUnwindSafe for Isotope
impl Send for Isotope
impl Sync for Isotope
impl Unpin for Isotope
impl UnsafeUnpin for Isotope
impl UnwindSafe for Isotope
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