simplebyteunit/README.md

33 lines
655 B
Markdown
Raw Normal View History

2023-09-29 03:42:24 +00:00
[![Rust](https://github.com/SapphirusBeryl/simplebyteunit/actions/workflows/rust.yml/badge.svg)](https://github.com/SapphirusBeryl/simplebyteunit/actions/workflows/rust.yml)
2023-09-27 05:12:35 +00:00
# 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]
2023-09-29 03:27:37 +00:00
simplebyteunit = "0.2.0"
2023-09-27 05:12:35 +00:00
```
## Example
Generate a human-readable, formatted ByteUnit:
```
use simplebyteunit::simplebyteunit::*;
let byteunit_var = 500000.to_byteunit(SI);
println!("{byteunit_var}");
```
Output:
```
2023-09-29 03:27:37 +00:00
500 kB
2023-09-27 05:12:35 +00:00
```