Crates.io | convert-byte-size-string |
lib.rs | convert-byte-size-string |
version | 1.1.2 |
source | src |
created_at | 2019-03-04 05:33:03.952735 |
updated_at | 2021-05-03 19:22:02.945316 |
description | Convert a byte size string to a u128 value. |
homepage | |
repository | https://github.com/demize/convert-byte-size-string |
max_upload_size | |
id | 118577 |
size | 13,975 |
This crate provides functionality to convert an arbitrary byte size string such as "7.9 EiB" into a u128
value usable wherever you need it.
Add the following to your Cargo.toml
:
[dependencies]
convert-byte-size-string = "1.0"
In your code, you can:
use convert_byte_size_string::convert_to_bytes;
let size: u128 = convert_to_bytes("7.9 EiB").unwrap();
This library has a fairly basic set of features: