Whippyunits 0.2.1 - now with stable rust!

⚓ Rust    📅 2026-06-17    👤 surdeus    👁️ 1      

surdeus

After a bit of a hiatus, I've gotten back to working on my units of measure crate, whippyunits.

Thanks to a generously-contributed typemath polyfill, whippyunits now works on stable rust - no more nightly const_generic_expressions! As a side-effect, algebraic intermediates now resolve correctly in r-a:

Why use whippyunits over UOM? Well...

  • Whippyunits is scale-encoded - it uses a log-prime-factorized representation to bake lossless rescaling into the type representation. This makes it extremely fixed-point friendly, and generally more numerically stable than other libraries.
  • Whippyunits supports ergonomic declarators - you can use declarator methods, a convenient quantity! macro that accepts flexible algebraic unit syntax (including UCUM unit strings), and even literals (see below).
  • Whippyunits is scale-explicit - arithmetic operations never implicitly rescale either of their arguments. Scale mismatches are compile errors; an inference-compatible rescale function can be applied to an argument to specify the behavior inline:
    image
  • Whippyunits has extensive developer tooling for prettyprinting verbose raw Quantity types in human-readable form (see screenshots above).
  • Whippyunits supports generic dimension traits, letting you very easily write code that is generic over scale and even over disjunctive sets of dimensions (think: signal processing that is generic over the dimensionality of the signal) while maintaining unit and scale safety when concretely invoked.

...and much, much more! For a full overview of what the library can do, see the examples section on github.

Feedback and contributions are welcome!

1 post - 1 participant

Read full topic

🏷️ Rust_feed