diff --git a/Cargo.toml b/Cargo.toml index 5e2d063..cf1d2b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ signal-hook = { version = "0.3.9", optional = true, default-features = false } is-terminal = { version = "0.4.9", optional = true } # units -bytesize = { version = "1.0.1", optional = true } +bytesize = { version = "2.0.1", optional = true } human_format = { version = "1.0.3", optional = true } [package.metadata.docs.rs] diff --git a/src/unit/bytes.rs b/src/unit/bytes.rs index a79f971..71371c4 100644 --- a/src/unit/bytes.rs +++ b/src/unit/bytes.rs @@ -8,7 +8,7 @@ pub struct Bytes; impl Bytes { fn format_bytes(w: &mut dyn fmt::Write, value: Step) -> fmt::Result { - let string = bytesize::to_string(value as u64, false); + let string = bytesize::ByteSize(value as u64).display().si().to_string(); for token in string.split(' ') { w.write_str(token)?; } diff --git a/tests/unit/mod.rs b/tests/unit/mod.rs index 0032f3d..d22903f 100644 --- a/tests/unit/mod.rs +++ b/tests/unit/mod.rs @@ -60,12 +60,12 @@ mod dynamic { None ) ), - "1.0KB/10.0GB [0%]" + "1.0kB/10.0GB [0%]" ); } #[test] fn just_value() { - assert_eq!(format!("{}", unit::dynamic(Bytes).display(5540, None, None)), "5.5KB"); + assert_eq!(format!("{}", unit::dynamic(Bytes).display(5540, None, None)), "5.5kB"); } } }