upgrade dependency ByteSize
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
3f0f89cddb
commit
5768ca8442
3 changed files with 49 additions and 62 deletions
|
@ -17,15 +17,13 @@ pub fn from_str(str: &str) -> Result<usize> {
|
|||
Ok(bytes)
|
||||
}
|
||||
|
||||
/// Output a human-readable size string w/ si-unit suffix
|
||||
/// Output a human-readable size string w/ iec-unit suffix
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn pretty(bytes: usize) -> String {
|
||||
const SI_UNITS: bool = true;
|
||||
|
||||
let bytes: u64 = bytes.try_into().expect("failed to convert usize to u64");
|
||||
|
||||
bytesize::to_string(bytes, SI_UNITS)
|
||||
ByteSize::b(bytes).display().iec().to_string()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue