Module database

Module database 

Source
Expand description

In-memory registry of known units + aliases.

Hand-seeded database of ~63 common units, each with one or more alias strings (meter, m, meters, metres all resolve to the same canonical Unit). Includes pre-built compound aliases (m/s, km/h, mph, rpm) as convenient shortcuts alongside the compound-unit parser.

Lookup also supports dynamic SI prefix stripping (e.g., “Gmeter” → giga + meter) and binary prefixes for information units. Fuzzy suggestions via Jaro-Winkler scoring help with typos.

Modules§

constants
Physical constants database.
seed 🔒
Builtin unit definitions: ~63 units with aliases, grouped by dimension.

Structs§

UnitDatabase
A collection of units keyed by every acceptable input alias.

Constants§

BINARY_PREFIXES 🔒
IEC binary prefixes for information units only.
SI_PREFIXES
SI metric prefixes: (long_name, symbol, scale_factor). Sorted by symbol length descending so “da” is tried before “d”. SI metric prefixes: (long_name, symbol, scale_factor).

Functions§

global
Returns the process-wide singleton database, initializing on first call.