Function unbytify::bytify [] [src]

pub fn bytify(value: u64) -> (f64, &'static str)

Converts a byte count to a human readable value

Returns a tuple of converted value with a suffix.

Example

extern crate unbytify;
use unbytify::*;

fn main() {
    assert_eq!(bytify(512), (512.0, "B"));
    assert_eq!(bytify(1024 + 512), (1.5, "KiB"));
}