mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update plurify version
This commit is contained in:
parent
f3e7ed60ee
commit
2d13f3ff8a
3 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@ impl Result {
|
|||
// Actions
|
||||
|
||||
pub fn update(&self, current: Option<usize>, 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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue