polyconvert 2.0.0
A library of functions for converting between different units of measurement.
The Cairo package includes the following categories:
Each category exposes:
Unit enum for the units in that categoryconvert function for supported conversionslength::inch_to_centimeterValues use the shared rational::Rational type so proofs can preserve exact arithmetic across unit conversions.
use polyconvert::length;
use polyconvert::rational::{from_fraction, from_integer};
fn example() {
let meters = from_integer(1);
let feet = length::meter_to_foot(meters);
let boiling_kelvin = polyconvert::temperature::celsius_to_kelvin(from_integer(100));
let quarter_foot = from_fraction(1, 4);
let inches = length::foot_to_inch(quarter_foot);
}
Run the Cairo tests with:
scarb test
Version 2.0.0
Uploaded 15 hours ago
Size 19.4 KB
Run the following command in your project dir
scarb add polyconvert@2.0.0
Or add the following line to your Scarb.toml
polyconvert = "2.0.0"