metrum

Crates.iometrum
lib.rsmetrum
version0.5.0
sourcesrc
created_at2023-09-22 20:03:00.903567
updated_at2023-09-25 13:30:57.442045
descriptionEasily work with and compare temeratures in different units
homepagehttps://github.com/deebloo/metrum
repositoryhttps://github.com/deebloo/metrum
max_upload_size
id980819
size35,580
Danny Blue (deebloo)

documentation

https://github.com/deebloo/metrum

README

metrum

Easily handle measurement values in rust.

The goal is to work with measurements without needing to think about about units until you absolutely have to.

For example: A Temp is itself a value. The units are just for display back to the user.

You can compare and combine temps safely without manually converting to and from different units.

For example you can subtract 10degC from 86degF. The crate will handle the conversions internally and give you a result in the initial unit.

use metrum:Temp;

let value = Temp::F(86.) - Temp::C(10.);

println("{}", value.as_k()); // 275.372

This also means you can safely compare temperatures in two different units

use metrum:Temp;

let value = Temp::F(86.) == Temp::C(30.); // true

Temps can be safely serialized and deserialized using serde when the serde feature is enabled.

[dependencies]
metrum = { version = "0.5.0", features = ["serde"] }
Commit count: 34

cargo fmt