Skip to content

Commit 4ff81bf

Browse files
authored
Merge pull request #33 from EliahKagan/bump-bytesize
Bump `bytesize` from major version 1 to 2
2 parents 58ea133 + 61dfa7d commit 4ff81bf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ signal-hook = { version = "0.3.9", optional = true, default-features = false }
8484
is-terminal = { version = "0.4.9", optional = true }
8585

8686
# units
87-
bytesize = { version = "1.0.1", optional = true }
87+
bytesize = { version = "2.0.1", optional = true }
8888
human_format = { version = "1.0.3", optional = true }
8989

9090
[package.metadata.docs.rs]

src/unit/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct Bytes;
88

99
impl Bytes {
1010
fn format_bytes(w: &mut dyn fmt::Write, value: Step) -> fmt::Result {
11-
let string = bytesize::to_string(value as u64, false);
11+
let string = bytesize::ByteSize(value as u64).display().si().to_string();
1212
for token in string.split(' ') {
1313
w.write_str(token)?;
1414
}

tests/unit/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ mod dynamic {
6060
None
6161
)
6262
),
63-
"1.0KB/10.0GB [0%]"
63+
"1.0kB/10.0GB [0%]"
6464
);
6565
}
6666
#[test]
6767
fn just_value() {
68-
assert_eq!(format!("{}", unit::dynamic(Bytes).display(5540, None, None)), "5.5KB");
68+
assert_eq!(format!("{}", unit::dynamic(Bytes).display(5540, None, None)), "5.5kB");
6969
}
7070
}
7171
}

0 commit comments

Comments
 (0)