convert-byte-size-string

Crates.ioconvert-byte-size-string
lib.rsconvert-byte-size-string
version1.1.2
sourcesrc
created_at2019-03-04 05:33:03.952735
updated_at2021-05-03 19:22:02.945316
descriptionConvert a byte size string to a u128 value.
homepage
repositoryhttps://github.com/demize/convert-byte-size-string
max_upload_size
id118577
size13,975
demize (demize)

documentation

README

convert-byte-size-string

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.

Usage

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();

Features

This library has a fairly basic set of features:

  • Convert byte size strings to u128 values based on the unit in the string, interpreting the unit as either a base 2 unit or a base 10 unit
  • Convert byte size strings based on the unit in the string, forcing the unit to be treated as either base 10 or base 2
Commit count: 7

cargo fmt