File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ pub const TIB: u64 = 1_099_511_627_776;
5858/// bytes size for 1 pebibyte
5959pub 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>.
6270static UNITS_SI : & str = "kMGTPE" ;
6371
6472static 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" ,
You can’t perform that action at this time.
0 commit comments