Crates.io | measurement-units |
lib.rs | measurement-units |
version | 0.1.1 |
source | src |
created_at | 2022-01-16 16:38:29.159317 |
updated_at | 2022-01-16 16:44:05.337845 |
description | Rust library for basic measurements units conversion such as length, mass, time, volume, percents. |
homepage | https://github.com/dobromyslov/measurement-units-rs#readme |
repository | https://github.com/dobromyslov/measurement-units-rs |
max_upload_size | |
id | 514991 |
size | 9,908 |
Rust library for basic measurements units conversion such as length, mass, time, volume, percents.
# Cargo.toml
[dependencies]
measurement-units = "0.1.1"
use measurement_units::{convert, Length};
let length_in_centimeters = convert(&1.0, &Length::M, &Length::CM, &Option::None);
assert_eq!(100.0, length_in_centimeters);
let length_in_meters = convert(&99.5, &Length::CM, &Length::M, &Some(0_u32));
assert_eq!(1.0, length_in_meters);
MIT (c) 2022 Viacheslav Dobromyslov <viacheslav@dobromyslov.ru>