Expand description
human_format is a library for formatting numbers into human readable strings. It supports SI, Time and Binary scales out of the box, and allows for custom scales as well.
§Setup
Add the library to your dependencies listing
$ cargo add human_format§Usage
Print human readable strings from numbers using SI scales by default
// "1.00 k"
let tmpStr = human_format::Formatter::new()
.format(1000.0);
// "1.00 M"
let tmpStr2 = human_format::Formatter::new()
.format(1000000.0);
// "1.00 G"
let tmpStr3 = human_format::Formatter::new()
.format(1000000000.0);If you are so inspired you can even try playing with units and customizing your Scales
For more examples you should review the examples on github: tests/demo.rs
Structs§
- Formatter
- Entry point to the library. Use this to handle your formatting needs.
- Scales
- Provide a customized scaling scheme for your own modeling.
Enums§
- Parse
Error - Errors returned by parsing operations.