You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-indicatif/0001-Update-number_prefix-t...

53 lines
1.9 KiB

From bb65a6667a038469e17ac73e9e91d704def8fb76 Mon Sep 17 00:00:00 2001
From: Michael <5672750+mibac138@users.noreply.github.com>
Date: Mon, 6 May 2019 00:44:53 +0200
Subject: [PATCH] Update number_prefix to 0.3 (#93)
---
src/format.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/format.rs b/src/format.rs
index ca0ed22..82ea3b8 100644
--- a/src/format.rs
+++ b/src/format.rs
@@ -1,7 +1,7 @@
use std::fmt;
use std::time::Duration;
-use number_prefix::{binary_prefix, decimal_prefix, PrefixNames, Prefixed, Standalone};
+use number_prefix::{NumberPrefix, PrefixNames, Prefixed, Standalone};
/// Wraps an std duration for human basic formatting.
#[derive(Debug)]
@@ -76,7 +76,7 @@ impl fmt::Display for HumanDuration {
impl fmt::Display for HumanBytes {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match binary_prefix(self.0 as f64) {
+ match NumberPrefix::binary(self.0 as f64) {
Standalone(number) => write!(f, "{:.0}B", number),
Prefixed(prefix, number) => write!(
f,
@@ -90,7 +90,7 @@ impl fmt::Display for HumanBytes {
impl fmt::Display for DecimalBytes {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match decimal_prefix(self.0 as f64) {
+ match NumberPrefix::decimal(self.0 as f64) {
Standalone(number) => write!(f, "{:.0}B", number),
Prefixed(prefix, number) => write!(f, "{:.2}{}B", number, prefix),
}
@@ -99,7 +99,7 @@ impl fmt::Display for DecimalBytes {
impl fmt::Display for BinaryBytes {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match binary_prefix(self.0 as f64) {
+ match NumberPrefix::binary(self.0 as f64) {
Standalone(number) => write!(f, "{:.0}B", number),
Prefixed(prefix, number) => write!(f, "{:.2}{}B", number, prefix),
}
--
2.21.0