update plurify version

This commit is contained in:
yggverse 2025-01-28 17:51:51 +02:00
parent f3e7ed60ee
commit 2d13f3ff8a
3 changed files with 6 additions and 3 deletions

View file

@ -7,6 +7,8 @@ pub trait Format {
impl Format for usize {
fn bytes(self) -> String {
use plurify::*;
const KB: f32 = 1024.0;
const MB: f32 = KB * KB;
const GB: f32 = MB * KB;
@ -14,7 +16,7 @@ impl Format for usize {
let f = self as f32;
if f < KB {
format!("{self} {}", plurify::ns(self, &["byte", "bytes", "bytes"]))
format!("{self} {}", self.plurify(&["byte", "bytes", "bytes"]))
} else if f < MB {
format!("{:.2} KB", f / KB)
} else if f < GB {