Elements
A comprehensive Rust crate providing type-safe enumerations and rich metadata for all chemical elements of the periodic table and their isotopes. The crate includes all 118 elements from Hydrogen to Oganesson with detailed information for each isotope including mass numbers, relative atomic masses, isotopic composition, and identification of the most abundant isotope. Chemical properties are fully supported: standard atomic weights, oxidation states with validation, valence electrons, bond numbers, electron configurations with atomic orbitals, and principal quantum numbers.
Would you like to see more information or features? Please open an issue or a pull request!
The crate is no_std, and optionally supports serde for serialization/deserialization and arbitrary for fuzzing.
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Basic Example
use ;
// Get an element
let carbon = C;
// Access properties
println!;
println!;
println!;
// Check oxidation states
assert!;
assert!;
// Get bond information
let = carbon.number_of_bonds;
assert_eq!;
Working with Isotopes
use ;
// Get a specific isotope
let carbon_12 = C12;
println!;
println!;
// Work with the generic Isotope enum
let isotope = C;
Parsing from Strings
use Element;
use FromStr;
// Parse element symbols
let oxygen = from_str.unwrap;
let nitrogen = from_str.unwrap;
Feature Flags
serde(default): EnablesSerializeandDeserializeimplementations forElementandIsotopetypesarbitrary: EnablesArbitraryimplementations forElementandIsotopetypes, useful for fuzzing
License
This project is licensed under the same terms as the parent EMI monorepo.