metrum

Crates.iometrum
lib.rsmetrum
version1.1.0
created_at2023-09-22 20:03:00.903567+00
updated_at2025-03-25 13:42:15.621285+00
descriptionEasily work with and compare temeratures in different units
homepage
repositoryhttps://github.com/deebloo/metrum
max_upload_size
id980819
size69,276
Danny Blue (deebloo)

documentation

https://docs.rs/metrum/0.5.0

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.

Length

Unit Constructor Conversion

Units

Unit Constructor Conversion
Celcius Temp::from_c(value) temp.as_c()
Farenheight Temp::from_f(value) temp.as_f()
Kelvin Temp::from_k(value) temp.as_k()

Speed

Unit Constructor Conversion
MPS Temp::from_mps(value) temp.as_mps()
KPH Temp::from_kph(value) temp.as_kph()
MPH Temp::from_mph(value) temp.as_mph()
Knots Temp::from_knots(value) temp.as_knots()

Temp

Unit Constructor Conversion
Celcius Temp::from_c(value) temp.as_c()
Farenheight Temp::from_f(value) temp.as_f()
Kelvin Temp::from_k(value) temp.as_k()
use metrum::Temp;
use metrum::temp::TempDelta;

let from_f = Temp::from_f(32.);
let from_c = Temp::from_c(0.);

assert_eq!(from_f, from_c);
assert_eq!(from_f - from_c, TempDelta { value: 0. });

Weight

Unit Constructor Conversion

Serde

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

[dependencies]
metrum = { version = "*", features = ["serde"] }

WASM

Metrum has limited compatibility with WASM and wasm-packg

[dependencies]
metrum = { version = "*", features = ["wasm"] }
Commit count: 102

cargo fmt