Skip to content

Commit c72ffa9

Browse files
committed
refactor: move statics to consts
1 parent 3ecd475 commit c72ffa9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,19 @@ pub const PIB: u64 = 1_125_899_906_842_624;
6161
/// IEC (binary) units.
6262
///
6363
/// See <https://en.wikipedia.org/wiki/Kilobyte>.
64-
static UNITS_IEC: &str = "KMGTPE";
64+
const UNITS_IEC: &str = "KMGTPE";
6565

6666
/// SI (decimal) units.
6767
///
6868
///
6969
/// See <https://en.wikipedia.org/wiki/Kilobyte>.
70-
static UNITS_SI: &str = "kMGTPE";
70+
const UNITS_SI: &str = "kMGTPE";
7171

72-
static LN_KIB: f64 = 6.931471806; // ln 1024
73-
static LN_KB: f64 = 6.907755279; // ln 1000
72+
/// `ln(1024) ~= 6.931`
73+
const LN_KIB: f64 = 6.931471806;
74+
75+
/// `ln(1000) ~= 6.908`
76+
const LN_KB: f64 = 6.907755279;
7477

7578
pub fn kb<V: Into<u64>>(size: V) -> u64 {
7679
size.into() * KB

0 commit comments

Comments
 (0)