4 stable releases
1.0.3 | Sep 30, 2020 |
---|---|
1.0.2 | Aug 23, 2020 |
1.0.0 | Aug 22, 2020 |
#1194 in Text processing
3,782 downloads per month
Used in 14 crates
(13 directly)
5KB
72 lines
A small function formatting a file size into the nearest ISO representation fitting into 4 characters.
Examples:
use file_size::fit_4;
assert_eq!(&fit_4(999), "999");
assert_eq!(&fit_4(12345), "12K");
assert_eq!(&fit_4(999_999), "1.0M");
assert_eq!(&fit_4(7_155_456_789_012), "7.2T");
lib.rs
:
Format a file size into 4 characters.
Examples:
use file_size::fit_4;
assert_eq!(&fit_4(999), "999");
assert_eq!(&fit_4(12345), "12K");
assert_eq!(&fit_4(999_999), "1.0M");
assert_eq!(&fit_4(7_155_456_789_012), "7.2T");
!