Crates.io | unbytify |
lib.rs | unbytify |
version | 0.2.0 |
source | src |
created_at | 2017-05-19 18:18:20.047052 |
updated_at | 2018-04-21 03:17:28.798122 |
description | Convert units of digital information from string into the numeric equivalent and the other way around |
homepage | https://github.com/niamster/unbytify |
repository | https://github.com/niamster/unbytify |
max_upload_size | |
id | 15198 |
size | 24,881 |
Unbytify converts KiB, MiB, etc. into integer and the other way around.
Sometimes people call this humanization.
In Cargo.toml:
[dependencies]
unbytify = "0.2"
In your main.rs
:
extern crate unbytify;
use unbytify::*;
fn main() {
assert_eq!(unbytify("1.5K"), Ok(1024 + 512));
assert_eq!(bytify(1024 + 512), (1.5, "KiB"));
}
Most of the useful documentation can be gotten using rustdoc.
Check it out on docs.rs/unbytify.
Unbytify project is licensed under Apache-2.0 license.