convert-units
Convert between units of measurement — length, area, mass, volume, temperature, time, digital, speed, pressure, energy, power, frequency, angle, and more (23 measures, 185 units), with a fluent API.
A faithful Rust port of the popular
convert-units npm package.
- Zero dependencies
to_bestto pick the most readable unitdescribe,list,measures, andpossibilitiesintrospection- Differential-tested against the reference
convert-unitsimplementation (all 185 × 185 unit pairs)
Install
[]
= "0.1"
Usage
use convert;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// Cross-measure conversions are rejected:
assert!;
Pick the most appropriate unit:
use convert;
let best = convert.from.unwrap.to_best.unwrap;
assert_eq!;
Introspect the available units:
use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Contributors ✨
This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.
Thanks goes to these wonderful people:
License
Licensed under either of MIT or Apache-2.0 at your option.