Skip to main content

Element

Enum Element 

Source
#[repr(u8)]
pub enum Element {
Show 118 variants H = 1, He = 2, B = 5, C = 6, N = 7, O = 8, F = 9, Ne = 10, Si = 14, P = 15, S = 16, Cl = 17, Ar = 18, Ge = 32, As = 33, Se = 34, Br = 35, Kr = 36, Sb = 51, Te = 52, I = 53, Xe = 54, At = 85, Rn = 86, Li = 3, Na = 11, K = 19, Rb = 37, Cs = 55, Fr = 87, Be = 4, Mg = 12, Ca = 20, Sr = 38, Ba = 56, Ra = 88, Al = 13, Ga = 31, In = 49, Sn = 50, Tl = 81, Pb = 82, Bi = 83, Po = 84, Sc = 21, Ti = 22, V = 23, Cr = 24, Mn = 25, Fe = 26, Co = 27, Ni = 28, Cu = 29, Zn = 30, Y = 39, Zr = 40, Nb = 41, Mo = 42, Tc = 43, Ru = 44, Rh = 45, Pd = 46, Ag = 47, Cd = 48, Hf = 72, Ta = 73, W = 74, Re = 75, Os = 76, Ir = 77, Pt = 78, Au = 79, Hg = 80, La = 57, Ce = 58, Pr = 59, Nd = 60, Pm = 61, Sm = 62, Eu = 63, Gd = 64, Tb = 65, Dy = 66, Ho = 67, Er = 68, Tm = 69, Yb = 70, Lu = 71, Ac = 89, Th = 90, Pa = 91, U = 92, Np = 93, Pu = 94, Am = 95, Cm = 96, Bk = 97, Cf = 98, Es = 99, Fm = 100, Md = 101, No = 102, Lr = 103, Rf = 104, Db = 105, Sg = 106, Bh = 107, Hs = 108, Mt = 109, Ds = 110, Rg = 111, Cn = 112, Nh = 113, Fl = 114, Mc = 115, Lv = 116, Ts = 117, Og = 118,
}
Expand description

Enumerates every element the typer understands along with its atomic number.

The variants are grouped by periodic trends (non-metals, alkali metals, etc.) so that code consuming this API can rely on exhaustive matches while still understanding the chemical context of each atom.

Variants§

§

H = 1

Hydrogen (H, Z = 1).

§

He = 2

Helium (He, Z = 2).

§

B = 5

Boron (B, Z = 5).

§

C = 6

Carbon (C, Z = 6).

§

N = 7

Nitrogen (N, Z = 7).

§

O = 8

Oxygen (O, Z = 8).

§

F = 9

Fluorine (F, Z = 9).

§

Ne = 10

Neon (Ne, Z = 10).

§

Si = 14

Silicon (Si, Z = 14).

§

P = 15

Phosphorus (P, Z = 15).

§

S = 16

Sulfur (S, Z = 16).

§

Cl = 17

Chlorine (Cl, Z = 17).

§

Ar = 18

Argon (Ar, Z = 18).

§

Ge = 32

Germanium (Ge, Z = 32).

§

As = 33

Arsenic (As, Z = 33).

§

Se = 34

Selenium (Se, Z = 34).

§

Br = 35

Bromine (Br, Z = 35).

§

Kr = 36

Krypton (Kr, Z = 36).

§

Sb = 51

Antimony (Sb, Z = 51).

§

Te = 52

Tellurium (Te, Z = 52).

§

I = 53

Iodine (I, Z = 53).

§

Xe = 54

Xenon (Xe, Z = 54).

§

At = 85

Astatine (At, Z = 85).

§

Rn = 86

Radon (Rn, Z = 86).

§

Li = 3

Lithium (Li, Z = 3).

§

Na = 11

Sodium (Na, Z = 11).

§

K = 19

Potassium (K, Z = 19).

§

Rb = 37

Rubidium (Rb, Z = 37).

§

Cs = 55

Cesium (Cs, Z = 55).

§

Fr = 87

Francium (Fr, Z = 87).

§

Be = 4

Beryllium (Be, Z = 4).

§

Mg = 12

Magnesium (Mg, Z = 12).

§

Ca = 20

Calcium (Ca, Z = 20).

§

Sr = 38

Strontium (Sr, Z = 38).

§

Ba = 56

Barium (Ba, Z = 56).

§

Ra = 88

Radium (Ra, Z = 88).

§

Al = 13

Aluminum (Al, Z = 13).

§

Ga = 31

Gallium (Ga, Z = 31).

§

In = 49

Indium (In, Z = 49).

§

Sn = 50

Tin (Sn, Z = 50).

§

Tl = 81

Thallium (Tl, Z = 81).

§

Pb = 82

Lead (Pb, Z = 82).

§

Bi = 83

Bismuth (Bi, Z = 83).

§

Po = 84

Polonium (Po, Z = 84).

§

Sc = 21

Scandium (Sc, Z = 21).

§

Ti = 22

Titanium (Ti, Z = 22).

§

V = 23

Vanadium (V, Z = 23).

§

Cr = 24

Chromium (Cr, Z = 24).

§

Mn = 25

Manganese (Mn, Z = 25).

§

Fe = 26

Iron (Fe, Z = 26).

§

Co = 27

Cobalt (Co, Z = 27).

§

Ni = 28

Nickel (Ni, Z = 28).

§

Cu = 29

Copper (Cu, Z = 29).

§

Zn = 30

Zinc (Zn, Z = 30).

§

Y = 39

Yttrium (Y, Z = 39).

§

Zr = 40

Zirconium (Zr, Z = 40).

§

Nb = 41

Niobium (Nb, Z = 41).

§

Mo = 42

Molybdenum (Mo, Z = 42).

§

Tc = 43

Technetium (Tc, Z = 43).

§

Ru = 44

Ruthenium (Ru, Z = 44).

§

Rh = 45

Rhodium (Rh, Z = 45).

§

Pd = 46

Palladium (Pd, Z = 46).

§

Ag = 47

Silver (Ag, Z = 47).

§

Cd = 48

Cadmium (Cd, Z = 48).

§

Hf = 72

Hafnium (Hf, Z = 72).

§

Ta = 73

Tantalum (Ta, Z = 73).

§

W = 74

Tungsten (W, Z = 74).

§

Re = 75

Rhenium (Re, Z = 75).

§

Os = 76

Osmium (Os, Z = 76).

§

Ir = 77

Iridium (Ir, Z = 77).

§

Pt = 78

Platinum (Pt, Z = 78).

§

Au = 79

Gold (Au, Z = 79).

§

Hg = 80

Mercury (Hg, Z = 80).

§

La = 57

Lanthanum (La, Z = 57).

§

Ce = 58

Cerium (Ce, Z = 58).

§

Pr = 59

Praseodymium (Pr, Z = 59).

§

Nd = 60

Neodymium (Nd, Z = 60).

§

Pm = 61

Promethium (Pm, Z = 61).

§

Sm = 62

Samarium (Sm, Z = 62).

§

Eu = 63

Europium (Eu, Z = 63).

§

Gd = 64

Gadolinium (Gd, Z = 64).

§

Tb = 65

Terbium (Tb, Z = 65).

§

Dy = 66

Dysprosium (Dy, Z = 66).

§

Ho = 67

Holmium (Ho, Z = 67).

§

Er = 68

Erbium (Er, Z = 68).

§

Tm = 69

Thulium (Tm, Z = 69).

§

Yb = 70

Ytterbium (Yb, Z = 70).

§

Lu = 71

Lutetium (Lu, Z = 71).

§

Ac = 89

Actinium (Ac, Z = 89).

§

Th = 90

Thorium (Th, Z = 90).

§

Pa = 91

Protactinium (Pa, Z = 91).

§

U = 92

Uranium (U, Z = 92).

§

Np = 93

Neptunium (Np, Z = 93).

§

Pu = 94

Plutonium (Pu, Z = 94).

§

Am = 95

Americium (Am, Z = 95).

§

Cm = 96

Curium (Cm, Z = 96).

§

Bk = 97

Berkelium (Bk, Z = 97).

§

Cf = 98

Californium (Cf, Z = 98).

§

Es = 99

Einsteinium (Es, Z = 99).

§

Fm = 100

Fermium (Fm, Z = 100).

§

Md = 101

Mendelevium (Md, Z = 101).

§

No = 102

Nobelium (No, Z = 102).

§

Lr = 103

Lawrencium (Lr, Z = 103).

§

Rf = 104

Rutherfordium (Rf, Z = 104).

§

Db = 105

Dubnium (Db, Z = 105).

§

Sg = 106

Seaborgium (Sg, Z = 106).

§

Bh = 107

Bohrium (Bh, Z = 107).

§

Hs = 108

Hassium (Hs, Z = 108).

§

Mt = 109

Meitnerium (Mt, Z = 109).

§

Ds = 110

Darmstadtium (Ds, Z = 110).

§

Rg = 111

Roentgenium (Rg, Z = 111).

§

Cn = 112

Copernicium (Cn, Z = 112).

§

Nh = 113

Nihonium (Nh, Z = 113).

§

Fl = 114

Flerovium (Fl, Z = 114).

§

Mc = 115

Moscovium (Mc, Z = 115).

§

Lv = 116

Livermorium (Lv, Z = 116).

§

Ts = 117

Tennessine (Ts, Z = 117).

§

Og = 118

Oganesson (Og, Z = 118).

Implementations§

Source§

impl Element

Source

pub fn valence_electrons(&self) -> Option<u8>

Returns the number of valence electrons for main-group elements.

This helper covers Groups 1–18 where valence counts follow periodic trends and returns None for transition metals, lanthanides, and actinides whose electron configurations require specialized treatment.

§Returns

Some(count) with the valence electron total when it can be determined or None for elements outside the supported groups.

Trait Implementations§

Source§

impl Clone for Element

Source§

fn clone(&self) -> Element

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Element

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Element

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Element

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Element

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses an atomic symbol into an Element variant.

The parser accepts standard IUPAC symbols (e.g., "C", "Mg") and maps them to the corresponding enum variant without case folding.

§Errors

Returns ParseElementError whenever the provided symbol is not listed in the periodic table definition above.

Source§

type Err = ParseElementError

The associated error which can be returned from parsing.
Source§

impl Hash for Element

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Element

Source§

fn cmp(&self, other: &Element) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Element

Source§

fn eq(&self, other: &Element) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Element

Source§

fn partial_cmp(&self, other: &Element) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Element

Source§

impl Eq for Element

Source§

impl StructuralPartialEq for Element

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,