From 58a023bd23268a206cdbb92c185824c627e6ee9d Mon Sep 17 00:00:00 2001 From: Wankko Ree Date: Tue, 23 Jan 2024 08:41:42 +0800 Subject: [PATCH 1/2] renders the speed in bytes per second using SI prefixes --- src/style.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/style.rs b/src/style.rs index 01b220f5..e3f39705 100644 --- a/src/style.rs +++ b/src/style.rs @@ -310,6 +310,12 @@ impl ProgressStyle { "bytes_per_sec" => buf .write_fmt(format_args!("{}/s", HumanBytes(state.per_sec() as u64))) .unwrap(), + "decimal_bytes_per_sec" => buf + .write_fmt(format_args!( + "{}/s", + DecimalBytes(state.per_sec() as u64) + )) + .unwrap(), "binary_bytes_per_sec" => buf .write_fmt(format_args!( "{}/s", From 8d2d50af46e0046669d4d8dbcc2f2e1146452408 Mon Sep 17 00:00:00 2001 From: Wankko Ree Date: Tue, 23 Jan 2024 20:47:46 +0800 Subject: [PATCH 2/2] complete mention --- src/lib.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2f7c8e9d..85fb3147 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -190,13 +190,23 @@ //! * `len`: renders the amount of work to be done as an integer //! * `human_len`: renders the total length of the bar as an integer, with commas as the thousands //! separator. -//! * `bytes`: renders the current position of the bar as bytes. //! * `percent`: renders the current position of the bar as a percentage of the total length. -//! * `total_bytes`: renders the total length of the bar as bytes. +//! * `bytes`: renders the current position of the bar as bytes (alias of `binary_bytes`). +//! * `total_bytes`: renders the total length of the bar as bytes (alias of `binary_total_bytes`). +//! * `decimal_bytes`: renders the current position of the bar as bytes using +//! power-of-10 units, i.e. `MB`, `kB`, etc. +//! * `decimal_total_bytes`: renders the total length of the bar as bytes using +//! power-of-10 units, i.e. `MB`, `kB`, etc. +//! * `binary_bytes`: renders the current position of the bar as bytes using +//! power-of-two units, i.e. `MiB`, `KiB`, etc. +//! * `binary_total_bytes`: renders the total length of the bar as bytes using +//! power-of-two units, i.e. `MiB`, `KiB`, etc. //! * `elapsed_precise`: renders the elapsed time as `HH:MM:SS`. //! * `elapsed`: renders the elapsed time as `42s`, `1m` etc. //! * `per_sec`: renders the speed in steps per second. -//! * `bytes_per_sec`: renders the speed in bytes per second. +//! * `bytes_per_sec`: renders the speed in bytes per second (alias of `binary_bytes_per_sec`). +//! * `decimal_bytes_per_sec`: renders the speed in bytes per second using +//! power-of-10 units, i.e. `MB`, `kB`, etc. //! * `binary_bytes_per_sec`: renders the speed in bytes per second using //! power-of-two units, i.e. `MiB`, `KiB`, etc. //! * `eta_precise`: the remaining time (like `elapsed_precise`).