Skip to content

Commit 3ecd475

Browse files
committed
docs: doc units_* statics
1 parent d9eef51 commit 3ecd475

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ pub const TIB: u64 = 1_099_511_627_776;
5858
/// bytes size for 1 pebibyte
5959
pub const PIB: u64 = 1_125_899_906_842_624;
6060

61-
static UNITS: &str = "KMGTPE";
61+
/// IEC (binary) units.
62+
///
63+
/// See <https://en.wikipedia.org/wiki/Kilobyte>.
64+
static UNITS_IEC: &str = "KMGTPE";
65+
66+
/// SI (decimal) units.
67+
///
68+
///
69+
/// See <https://en.wikipedia.org/wiki/Kilobyte>.
6270
static UNITS_SI: &str = "kMGTPE";
6371

6472
static LN_KIB: f64 = 6.931471806; // ln 1024
@@ -182,7 +190,7 @@ pub fn to_string(bytes: u64, si_prefix: bool) -> String {
182190

183191
let unit_prefix = match si_prefix {
184192
true => UNITS_SI.as_bytes(),
185-
false => UNITS.as_bytes(),
193+
false => UNITS_IEC.as_bytes(),
186194
};
187195
let unit_suffix = match si_prefix {
188196
true => "B",

0 commit comments

Comments
 (0)