pub struct Element(/* private fields */);Expand description
A chemical element, identified by its atomic number Z — the proton count.
Implementations§
Source§impl Element
impl Element
Sourcepub const fn new(z: u8) -> Option<Self>
pub const fn new(z: u8) -> Option<Self>
Constructs an element from atomic number z, returning None if z is zero.
Sourcepub const fn from_nonzero(z: NonZeroU8) -> Self
pub const fn from_nonzero(z: NonZeroU8) -> Self
Constructs an element from a NonZeroU8 atomic number directly.
Sourcepub fn from_symbol(symbol: &str) -> Option<Self>
pub fn from_symbol(symbol: &str) -> Option<Self>
Constructs an element from its symbol (e.g. "C", "Og", "Uue"),
returning None if no element has that symbol.
The exact, case-sensitive inverse of symbol.
Sourcepub const fn atomic_number(self) -> u8
pub const fn atomic_number(self) -> u8
Returns the atomic number Z (the proton count), always greater than zero.
Sourcepub fn symbol(self) -> &'static str
pub fn symbol(self) -> &'static str
Returns the element symbol (e.g. "C", "Og").
Elements with Z > 118 return their IUPAC systematic symbol (e.g. "Uue").
Trait Implementations§
impl Copy for Element
impl Eq for Element
Source§impl Ord for Element
impl Ord for Element
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Element
impl PartialOrd for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
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