Crates.io | si-unit-prefix |
lib.rs | si-unit-prefix |
version | 1.0.0 |
source | src |
created_at | 2022-10-08 09:35:38.298456 |
updated_at | 2022-10-08 09:35:38.298456 |
description | SI Unit Prefix enum impl as_f64/f32, as_exp, parse_from_str with serde support. |
homepage | |
repository | https://github.com/usagi/si-unit-prefix/ |
max_upload_size | |
id | 683435 |
size | 15,863 |
This library is ideal for simple Rust handling of SI unit prefixes.
SiUnitPrefix::G
to represent "Giga".
.as_f64()
: eg. SiUnitPrefix::G.as_f64()
-> 1e+9f64
.as_f32()
: eg. SiUnitPrefix::G.as_f32()
-> 1e+9f32
.as_exp()
: eg. SiUnitPrefix::G.as_exp()
-> 9i8
.parse(str)
: eg. SiUnitPrefix::parse_from_str("G")
-> SiUnitPrefix::G
serde::Serialize
/serde::Deserialize
Clone
/Copy
PartialEq
/Eq
PartialOrd
/Ord
Debug
See tests/test.rs file. It's so simple. :)
MIT