Expand description

readable_byte is an implmentation of human-readable bytesize

Example

extern crate readable_byte;

use readable_byte::readable_byte;

fn byte_arithmetic_operator() {
  let x = readable_byte::mb(1);
  let y = readable_byte::kb(100);

  let plus = x + y;
  print!("{} bytes", plus.as_u64());

}

It also provides its human readable string as follows:

use readable_byte::to_string_u64;
 assert_eq!("448.9 GiB".to_string(), to_string_u64(readable_byte::gb(482_u64),true));
 assert_eq!("518.0 GB".to_string(), to_string_u64(readable_byte::gb(518_u64),false));

Structs

Byte size representation

Constants

byte size for 1 byte

bytes size for 1 gigabyte

bytes size for 1 gibibyte

bytes size for 1 kilobyte

bytes size for 1 kibibyte

bytes size for 1 megabyte

bytes size for 1 mebibyte

bytes size for 1 petabyte

bytes size for 1 pebibyte

bytes size for 1 terabyte

bytes size for 1 tebibyte

Functions