Crates.io | super-units |
lib.rs | super-units |
version | 1.0.2 |
source | src |
created_at | 2020-07-06 02:12:58.443146 |
updated_at | 2020-07-08 06:11:57.282927 |
description | Handle byte units easily |
homepage | https://github.com/mota/super-units |
repository | https://github.com/mota/super-units |
max_upload_size | |
id | 261789 |
size | 6,018 |
Handle byte units easily
extern crate super_units;
use super_units::Amount;
fn main() {
let amount = Amount::auto_detect(32_f64 * 1024_f64);
println!("{}", amount); // 32.0 Kb
println!("{}", amount.bytes()); // 32768.0
println!("{}", amount.quantity()); // 32.0
println!("{}", amount.unit()); // Kb
}