periodic_elements/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(not(feature = "std"), feature(alloc))]
3
4//! # periodic-elements
5//! This crate provides a list of all 118 discovered elements, as well as additional information
6//! about each. You'll probably want to use the constant [`ELEMENTS`], as it provides a `'static`
7//! slice of elements. Additionally, this crate uses [std::borrow::Cow] extensively, as it allows
8//! for mutating element information very efficiently, while not requiring heap allocations by
9//! default. Additionally, every field within [`Element`] supports [`std::fmt::Display`]
10//! (with the exception of [`cpk`](Element::cpk)) and [`std::fmt::Debug`], making it easy to display.
11#[cfg(not(feature = "std"))]
12extern crate alloc;
13#[cfg(feature = "std")]
14extern crate std as alloc;
15
16
17use rgb::RGB8;
18
19use alloc::borrow::Cow;
20pub use parts::exports::*;
21pub use raw::*;
22
23mod raw;
24mod parts;
25
26#[derive(Debug, Clone)]
27pub struct Element<'a> {
28	pub number: u16,
29	pub symbol: Cow<'a, str>,
30	pub name: Cow<'a, str>,
31	pub mass: Mass,
32	pub cpk: Option<RGB8>,
33	pub electron_configuration: ElectronConfiguration<'a>,
34	pub electronegativity: Option<f32>,
35	pub atomic_radius: Option<u16>,
36	pub ion_radius: Option<IonRadius>,
37	pub van_del_walls_radius: Option<u16>,
38	pub ionization_energy: Option<u16>,
39	pub electron_affinity: Option<i16>,
40	pub oxidation_states: Cow<'a, [i8]>,
41	pub standard_state: Option<State>,
42	pub bonding_type: Option<BondingType>,
43	pub melting_point: Option<i16>,
44	pub boiling_point: Option<i16>,
45	pub density: Option<f64>,
46	pub group_block: Block,
47	pub discovered: Year,
48}