4 releases

0.1.3 Sep 24, 2024
0.1.2 Jul 15, 2024
0.1.1 Jul 15, 2024
0.1.0 Jul 14, 2024

#115 in Value formatting

Download history 6/week @ 2024-08-19 8/week @ 2024-08-26 30/week @ 2024-09-02 9/week @ 2024-09-09 33/week @ 2024-09-16 163/week @ 2024-09-23 85/week @ 2024-09-30 7/week @ 2024-10-07 39/week @ 2024-10-14 24/week @ 2024-10-21 101/week @ 2024-10-28 147/week @ 2024-11-04 10/week @ 2024-11-11 14/week @ 2024-11-18 14/week @ 2024-11-25 32/week @ 2024-12-02

71 downloads per month
Used in git-metrics

MIT license

17KB
340 lines

Human Number

This library is just made to format numbers in a pretty human readable way.

Installation

cargo add human-number

Usage

// Using SI scales
let formatter = Formatter::si().with_unit("g");
let result = format!("{}", formatter.format(40_280.0));
assert_eq!(result, "40.28 kg");
let result = format!("{}", formatter.format(0.04823));
assert_eq!(result, "48.23 mg");

// Using binary scales
let formatter = Formatter::binary().with_unit("B");
let result = format!("{}", formatter.format(4096.0));
assert_eq!(result, "4.00 kiB");

No runtime deps