convert-byte-size-string 1.1.2

Convert a byte size string to a u128 value.
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented1 out of 4 items with examples
  • Size
  • Source code size: 13.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 460.39 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • demize/convert-byte-size-string
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • demize

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