pub fn unit_from_string(symbol: impl Into<String>) -> UnitExpand description
Helper function to get a Unit from a string symbol, using the default
registry. Fabricates a unit for an unregistered symbol instead of
erroring (kept infallible for the large existing call-site surface —
see try_unit_from_string for the fallible alternative).
U1 fix: the fabricated unit’s dimension is Custom(symbol), not
Count. Previously every unregistered symbol landed in the shared
Count dimension, so two different typos (or two unrelated free-form
business units, e.g. “orders” vs “widgets”) were treated as the same
dimension and converted 1:1 with no error — the actual bug this gap
caused. Keying the fabricated dimension by the symbol itself means
convert() now correctly reports IncompatibleDimensions between any
two distinct unregistered units, while a symbol converted against
itself (the only sane use of an ad-hoc unit) still works.