pub struct Element(/* private fields */);Expand description
An element represented as its atomic number, wrapped in a newtype.
Zero-copy: implements Copy; comparison and hashing are O(1).
Implementations§
Source§impl Element
impl Element
pub const H: Element
pub const HE: Element
pub const LI: Element
pub const BE: Element
pub const B: Element
pub const C: Element
pub const N: Element
pub const O: Element
pub const F: Element
pub const NE: Element
pub const NA: Element
pub const MG: Element
pub const AL: Element
pub const SI: Element
pub const P: Element
pub const S: Element
pub const CL: Element
pub const AR: Element
pub const K: Element
pub const CA: Element
pub const SC: Element
pub const TI: Element
pub const V: Element
pub const CR: Element
pub const MN: Element
pub const FE: Element
pub const CO: Element
pub const NI: Element
pub const CU: Element
pub const ZN: Element
pub const GA: Element
pub const GE: Element
pub const AS: Element
pub const SE: Element
pub const BR: Element
pub const KR: Element
pub const RB: Element
pub const SR: Element
pub const Y: Element
pub const ZR: Element
pub const NB: Element
pub const MO: Element
pub const TC: Element
pub const RU: Element
pub const RH: Element
pub const PD: Element
pub const AG: Element
pub const CD: Element
pub const IN: Element
pub const SN: Element
pub const SB: Element
pub const TE: Element
pub const I: Element
pub const XE: Element
pub const CS: Element
pub const BA: Element
pub const LA: Element
pub const CE: Element
pub const PR: Element
pub const ND: Element
pub const PM: Element
pub const SM: Element
pub const EU: Element
pub const GD: Element
pub const TB: Element
pub const DY: Element
pub const HO: Element
pub const ER: Element
pub const TM: Element
pub const YB: Element
pub const LU: Element
pub const HF: Element
pub const TA: Element
pub const W: Element
pub const RE: Element
pub const OS: Element
pub const IR: Element
pub const PT: Element
pub const AU: Element
pub const HG: Element
pub const TL: Element
pub const PB: Element
pub const BI: Element
pub const PO: Element
pub const AT: Element
pub const RN: Element
pub const FR: Element
pub const RA: Element
pub const AC: Element
pub const TH: Element
pub const PA: Element
pub const U: Element
pub const NP: Element
pub const PU: Element
pub const AM: Element
pub const CM: Element
pub const BK: Element
pub const CF: Element
pub const ES: Element
pub const FM: Element
pub const MD: Element
pub const NO: Element
pub const LR: Element
pub const RF: Element
pub const DB: Element
pub const SG: Element
pub const BH: Element
pub const HS: Element
pub const MT: Element
pub const DS: Element
pub const RG: Element
pub const CN: Element
pub const NH: Element
pub const FL: Element
pub const MC: Element
pub const LV: Element
pub const TS: Element
pub const OG: Element
Sourcepub const fn from_atomic_number(n: u8) -> Option<Self>
pub const fn from_atomic_number(n: u8) -> Option<Self>
Create an Element from an atomic number. Returns None if n is outside 1–118.
Sourcepub fn from_symbol(s: &str) -> Option<Self>
pub fn from_symbol(s: &str) -> Option<Self>
Create an Element from its symbol (title-case, e.g. “C”, “Cl”). Case-sensitive: “C” is carbon, “c” is not accepted.
Sourcepub fn atomic_number(self) -> u8
pub fn atomic_number(self) -> u8
Return the atomic number (1–118).
Sourcepub fn is_organic_subset(self) -> bool
pub fn is_organic_subset(self) -> bool
Returns true if this element is in the OpenSMILES organic subset (B, C, N, O, P, S, F, Cl, Br, I) — these may carry implicit H without brackets.
Sourcepub fn normal_valences(self) -> &'static [u8] ⓘ
pub fn normal_valences(self) -> &'static [u8] ⓘ
Normal valence list (ascending). Empty = undefined (transition metals, etc.). Used for computing implicit H counts in organic-subset atoms.
Trait Implementations§
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 Copy for Element
impl Eq 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