Debian Codegraph @

src/properties/group.rs

raw symbols SCIP
1 use super::{Element, Group};
2
3 impl Element {
4 /// Returns the element's group in the periodic table, if any.
5 ///
6 /// ```
7 /// use mendeleev::{Element, Group};
8 /// assert_eq!(Element::H.group(), Some(Group::IA));
9 /// assert_eq!(Element::Og.group(), Some(Group::VIIIA));
10 /// assert_eq!(Element::U.group(), None);
11 /// ```
12 pub const fn group(&self) -> Option<Group> {
13 match self {
14 Element::H => Some(Group::IA),
15 Element::He => Some(Group::VIIIA),
16 Element::Li => Some(Group::IA),
17 Element::Be => Some(Group::IIA),
18 Element::B => Some(Group::IIIA),
19 Element::C => Some(Group::IVA),
20 Element::N => Some(Group::VA),
21 Element::O => Some(Group::VIA),
22 Element::F => Some(Group::VIIA),
23 Element::Ne => Some(Group::VIIIA),
24 Element::Na => Some(Group::IA),
25 Element::Mg => Some(Group::IIA),
26 Element::Al => Some(Group::IIIA),
27 Element::Si => Some(Group::IVA),
28 Element::P => Some(Group::VA),
29 Element::S => Some(Group::VIA),
30 Element::Cl => Some(Group::VIIA),
31 Element::Ar => Some(Group::VIIIA),
32 Element::K => Some(Group::IA),
33 Element::Ca => Some(Group::IIA),
34 Element::Sc => Some(Group::IIIB),
35 Element::Ti => Some(Group::IVB),
36 Element::V => Some(Group::VB),
37 Element::Cr => Some(Group::VIB),
38 Element::Mn => Some(Group::VIIB),
39 Element::Fe => Some(Group::VIIIB8),
40 Element::Co => Some(Group::VIIIB9),
41 Element::Ni => Some(Group::VIIIB10),
42 Element::Cu => Some(Group::IB),
43 Element::Zn => Some(Group::IIB),
44 Element::Ga => Some(Group::IIIA),
45 Element::Ge => Some(Group::IVA),
46 Element::As => Some(Group::VA),
47 Element::Se => Some(Group::VIA),
48 Element::Br => Some(Group::VIIA),
49 Element::Kr => Some(Group::VIIIA),
50 Element::Rb => Some(Group::IA),
51 Element::Sr => Some(Group::IIA),
52 Element::Y => Some(Group::IIIB),
53 Element::Zr => Some(Group::IVB),
54 Element::Nb => Some(Group::VB),
55 Element::Mo => Some(Group::VIB),
56 Element::Tc => Some(Group::VIIB),
57 Element::Ru => Some(Group::VIIIB8),
58 Element::Rh => Some(Group::VIIIB9),
59 Element::Pd => Some(Group::VIIIB10),
60 Element::Ag => Some(Group::IB),
61 Element::Cd => Some(Group::IIB),
62 Element::In => Some(Group::IIIA),
63 Element::Sn => Some(Group::IVA),
64 Element::Sb => Some(Group::VA),
65 Element::Te => Some(Group::VIA),
66 Element::I => Some(Group::VIIA),
67 Element::Xe => Some(Group::VIIIA),
68 Element::Cs => Some(Group::IA),
69 Element::Ba => Some(Group::IIA),
70 Element::La => None,
71 Element::Ce => None,
72 Element::Pr => None,
73 Element::Nd => None,
74 Element::Pm => None,
75 Element::Sm => None,
76 Element::Eu => None,
77 Element::Gd => None,
78 Element::Tb => None,
79 Element::Dy => None,
80 Element::Ho => None,
81 Element::Er => None,
82 Element::Tm => None,
83 Element::Yb => None,
84 Element::Lu => Some(Group::IIIB),
85 Element::Hf => Some(Group::IVB),
86 Element::Ta => Some(Group::VB),
87 Element::W => Some(Group::VIB),
88 Element::Re => Some(Group::VIIB),
89 Element::Os => Some(Group::VIIIB8),
90 Element::Ir => Some(Group::VIIIB9),
91 Element::Pt => Some(Group::VIIIB10),
92 Element::Au => Some(Group::IB),
93 Element::Hg => Some(Group::IIB),
94 Element::Tl => Some(Group::IIIA),
95 Element::Pb => Some(Group::IVA),
96 Element::Bi => Some(Group::VA),
97 Element::Po => Some(Group::VIA),
98 Element::At => Some(Group::VIIA),
99 Element::Rn => Some(Group::VIIIA),
100 Element::Fr => Some(Group::IA),
101 Element::Ra => Some(Group::IIA),
102 Element::Ac => None,
103 Element::Th => None,
104 Element::Pa => None,
105 Element::U => None,
106 Element::Np => None,
107 Element::Pu => None,
108 Element::Am => None,
109 Element::Cm => None,
110 Element::Bk => None,
111 Element::Cf => None,
112 Element::Es => None,
113 Element::Fm => None,
114 Element::Md => None,
115 Element::No => None,
116 Element::Lr => Some(Group::IIIB),
117 Element::Rf => Some(Group::IVB),
118 Element::Db => Some(Group::VB),
119 Element::Sg => Some(Group::VIB),
120 Element::Bh => Some(Group::VIIB),
121 Element::Hs => Some(Group::VIIIB8),
122 Element::Mt => Some(Group::VIIIB9),
123 Element::Ds => Some(Group::VIIIB10),
124 Element::Rg => Some(Group::IB),
125 Element::Cn => Some(Group::IIB),
126 Element::Nh => Some(Group::IIIA),
127 Element::Fl => Some(Group::IVA),
128 Element::Mc => Some(Group::VA),
129 Element::Lv => Some(Group::VIA),
130 Element::Ts => Some(Group::VIIA),
131 Element::Og => Some(Group::VIIIA),
132 }
133 }
134 }