use-element
use-element provides a small Element value type plus direct lookup helpers backed by a static table for elements 1 through 118. It is intended as the foundational chemistry primitive crate for the RustUse chemistry workspace.
What this crate provides
| Item | Purpose |
|---|---|
Element |
Small copyable element value with atomic number, symbol, name, mass, period, and group |
all_elements() |
Full static slice of the known elements |
element_by_symbol() |
Symbol lookup with ASCII case-insensitive matching |
element_by_atomic_number() |
Direct atomic-number lookup |
element_name() |
Symbol-to-name helper |
element_symbol() |
Atomic-number-to-symbol helper |
Symbol lookup behavior
Symbol lookup trims surrounding whitespace and compares symbols with ASCII case-insensitive matching. That means "Na", "na", and " NA " all resolve to sodium.
Installation
[]
= "0.1.0"
Quick examples
Lookup by symbol
use ;
let carbon = element_by_symbol.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
Lookup by atomic number
use ;
let oxygen = element_by_atomic_number.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Scope
- Static periodic-table data only.
- No runtime network access.
- No isotope tables.
- No molecular or reaction modeling.
- Conservative group assignment for lanthanides and actinides via
None.