3 stable releases

1.0.2 Jul 8, 2020
1.0.1 Jul 6, 2020

#477 in Science

33 downloads per month

MIT license

6KB
132 lines

Super Units Rust

Handle byte units easily

Usage

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
}

No runtime deps