From 2d13f3ff8a8f060b93f3c9caf94a6f83ad0ddcf7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 28 Jan 2025 17:51:51 +0200 Subject: [PATCH] update `plurify` version --- Cargo.toml | 2 +- src/app/browser/window/tab/item/page/search/form/result.rs | 3 ++- src/tool.rs | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e9d27281..917e73ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ indexmap = "2.7.0" itertools = "0.14.0" libspelling = "0.3.0" openssl = "0.10.68" -plurify = "0.1.1" +plurify = "0.2.0" syntect = "5.2.0" # development diff --git a/src/app/browser/window/tab/item/page/search/form/result.rs b/src/app/browser/window/tab/item/page/search/form/result.rs index 0a1053e2..1d9fd2ec 100644 --- a/src/app/browser/window/tab/item/page/search/form/result.rs +++ b/src/app/browser/window/tab/item/page/search/form/result.rs @@ -29,8 +29,9 @@ impl Result { // Actions pub fn update(&self, current: Option, total: usize) { + use plurify::*; if total > 0 { - let matches = plurify::ns(total, &["match", "matches", "matches"]); + let matches = total.plurify(&["match", "matches", "matches"]); match current { Some(position) => self .label diff --git a/src/tool.rs b/src/tool.rs index 1fe43cb6..cd18ed27 100644 --- a/src/tool.rs +++ b/src/tool.rs @@ -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 {