Crate unbytify

Source
Expand description

§Unbytify is a library to parse and represent digital units

§Installation

To start using unbytify it’s enough to just enable it in your Cargo.toml:

[dependencies]
unbytify = "0.2"

A simple example should be self-explanatory:

extern crate unbytify;
use unbytify::*;

fn main() {
    assert_eq!(unbytify("1.5K"), Ok(1024 + 512));
    assert_eq!(bytify(1024 + 512), (1.5, "KiB"));
}

Enums§

ParseError
Represents parse failure

Functions§

bytify
Converts a byte count to a human readable value
unbytify
Converts human readable number of bytes to a byte count