#kb #byte-unit #simplebyteunit

simplebyteunit

A thin encapsulate for integer primitives to facilitate a fast, simple, yet ergonomic byteunit implementation

4 releases

0.2.1 Oct 1, 2023
0.2.0 Sep 29, 2023
0.1.1 Sep 27, 2023
0.1.0 Sep 27, 2023

#267 in Value formatting


Used in 3 crates (2 directly)

Apache-2.0

21KB
408 lines

Rust

SimpleByteUnit

SimpleByteUnit is a crate which provides a thin encapsulate for integer primitives to facilitate a fast, simple, yet ergonomic byteunit implementation.

Usage

Add 'simplebyteunit' to your 'Cargo.toml':

[dependencies]
simplebyteunit = "0.2.0"

Example

Generate a human-readable, formatted ByteUnit:

use simplebyteunit::simplebyteunit::*;

let byteunit_var = 500000.to_byteunit(SI);

println!("{byteunit_var}");

Output:

500 kB

No runtime deps