use-element 0.1.0

Small chemical element primitives and lookup helpers for RustUse
Documentation
  • Coverage
  • 57.14%
    8 out of 14 items documented5 out of 8 items with examples
  • Size
  • Source code size: 19.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 399.5 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 28s Average build duration of successful builds.
  • all releases: 28s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-chemistry
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

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

[dependencies]
use-element = "0.1.0"

Quick examples

Lookup by symbol

use use_element::{element_by_symbol, element_name};

let carbon = element_by_symbol("c").unwrap();

assert_eq!(carbon.atomic_number, 6);
assert_eq!(carbon.name, "Carbon");
assert_eq!(element_name("C"), Some("Carbon"));

Lookup by atomic number

use use_element::{element_by_atomic_number, element_symbol};

let oxygen = element_by_atomic_number(8).unwrap();

assert_eq!(oxygen.symbol, "O");
assert_eq!(oxygen.period, 2);
assert_eq!(oxygen.group, Some(16));
assert_eq!(element_symbol(79), Some("Au"));

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.