Skip to content

Commit

Permalink
Update humansize dependency to current v2.1.3 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Feb 6, 2024
1 parent 54c5965 commit d3effd9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pcap-file = "2.0.0"
tempfile = "3.3.0"
bitfield = "0.13.2"
num-format = "0.4.0"
humansize = "1.1.1"
humansize = "2.1.3"
bisection = "0.1.0"
derive_more = "0.99.17"
rusb = "0.9.1"
Expand Down
7 changes: 2 additions & 5 deletions src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use num_format::{Locale, ToFormattedString};
use humansize::{FileSize, file_size_opts as options};
use humansize::{SizeFormatter, BINARY};

pub fn fmt_count(count: u64) -> String {
count.to_formatted_string(&Locale::en)
Expand All @@ -11,9 +11,6 @@ pub fn fmt_size(size: u64) -> String {
} else if size < 1024 {
format!("{size} bytes")
} else {
match size.file_size(options::BINARY) {
Ok(string) => string,
Err(e) => format!("<Error: {e}>")
}
format!("{}", SizeFormatter::new(size, BINARY))
}
}

0 comments on commit d3effd9

Please sign in to comment.