This is a Rust library for chemistry.
- Install this package from crates.io.
Here's some sample code that shows how you can get the atomic mass, boiling point, and density of hydrogen.
/* Note: These snippets are untested */
use periodic_table_rs::HYDROGEN;
fn main() {
println!("{}", HYDROGEN.atomic_mass);
println!("{}", HYDROGEN.boiling_point);
println!("{}", HYDROGEN.density);
}
/* Or, you can do this. */
use periodic_table_rs::{Element, PERIODIC_TABLE};
fn main() {
const HYDROGEN: Element = PERIODIC_TABLE[0];
println!("{}", HYDROGEN.atomic_mass);
println!("{}", HYDROGEN.boiling_point);
println!("{}", HYDROGEN.density);
}
The documentation for this project is in its crates.io page. Here's a quick link to it.
The element data in this library primarily came from PubChem with some of its missing fields filled in by the data from the Royal Society of Chemistry.
The combined and parsed element data from both these sources is in this json file and you can use it in your own projects if all you need is the raw element data :D