Skip to main content

memory

Function memory 

Source
pub fn memory(value: impl AsPrimitive<u64>, precision: Option<usize>) -> String
Expand description

Formats a number of bytes with memory units, rounded to the supplied number of decimal places.

ยงExamples

use kwik::fmt;

assert_eq!(fmt::memory(1_234_567, Some(2)), "1.18 MiB");