mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Update humansize to version 2
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -1696,9 +1696,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humansize"
|
name = "humansize"
|
||||||
version = "1.1.1"
|
version = "2.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026"
|
checksum = "4e682e2bd70ecbcce5209f11a992a4ba001fea8e60acf7860ce007629e6d2756"
|
||||||
|
dependencies = [
|
||||||
|
"libm",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humantime"
|
name = "humantime"
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ toml = "0.5"
|
|||||||
url = "2"
|
url = "2"
|
||||||
uuid = { version = "1", features = ["serde", "v4"] }
|
uuid = { version = "1", features = ["serde", "v4"] }
|
||||||
fast-socks5 = "0.8"
|
fast-socks5 = "0.8"
|
||||||
humansize = "1"
|
humansize = "2"
|
||||||
qrcodegen = "1.7.0"
|
qrcodegen = "1.7.0"
|
||||||
tagger = "4.3.3"
|
tagger = "4.3.3"
|
||||||
textwrap = "0.16.0"
|
textwrap = "0.16.0"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::tools::time;
|
|||||||
use crate::{config::Config, scheduler::Scheduler, stock_str, tools};
|
use crate::{config::Config, scheduler::Scheduler, stock_str, tools};
|
||||||
use crate::{context::Context, log::LogExt};
|
use crate::{context::Context, log::LogExt};
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use humansize::{file_size_opts, FileSize};
|
use humansize::{format_size, BINARY};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumProperty, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumProperty, PartialOrd, Ord)]
|
||||||
pub enum Connectivity {
|
pub enum Connectivity {
|
||||||
@@ -495,12 +495,8 @@ impl Context {
|
|||||||
// - the string is not longer than the other strings that way (minus title, plus units) -
|
// - the string is not longer than the other strings that way (minus title, plus units) -
|
||||||
// additional linebreaks on small displays are unlikely therefore
|
// additional linebreaks on small displays are unlikely therefore
|
||||||
// - most times, this is the only item anyway
|
// - most times, this is the only item anyway
|
||||||
let usage = (resource.usage * 1024)
|
let usage = format_size(resource.usage * 1024, BINARY);
|
||||||
.file_size(file_size_opts::BINARY)
|
let limit = format_size(resource.limit * 1024, BINARY);
|
||||||
.unwrap_or_default();
|
|
||||||
let limit = (resource.limit * 1024)
|
|
||||||
.file_size(file_size_opts::BINARY)
|
|
||||||
.unwrap_or_default();
|
|
||||||
stock_str::part_of_total_used(self, usage, limit).await
|
stock_str::part_of_total_used(self, usage, limit).await
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::context::Context;
|
|||||||
use crate::message::{Message, Viewtype};
|
use crate::message::{Message, Viewtype};
|
||||||
use crate::param::Param;
|
use crate::param::Param;
|
||||||
use crate::tools::timestamp_to_str;
|
use crate::tools::timestamp_to_str;
|
||||||
use humansize::{file_size_opts, FileSize};
|
use humansize::{format_size, BINARY};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct StockStrings {
|
pub struct StockStrings {
|
||||||
@@ -1127,9 +1127,7 @@ pub(crate) async fn quota_exceeding(context: &Context, highest_usage: u64) -> St
|
|||||||
|
|
||||||
/// Stock string: `%1$s message` with placeholder replaced by human-readable size.
|
/// Stock string: `%1$s message` with placeholder replaced by human-readable size.
|
||||||
pub(crate) async fn partial_download_msg_body(context: &Context, org_bytes: u32) -> String {
|
pub(crate) async fn partial_download_msg_body(context: &Context, org_bytes: u32) -> String {
|
||||||
let size = org_bytes
|
let size = format_size(org_bytes, BINARY);
|
||||||
.file_size(file_size_opts::BINARY)
|
|
||||||
.unwrap_or_default();
|
|
||||||
translated(context, StockMessage::PartialDownloadMsgBody)
|
translated(context, StockMessage::PartialDownloadMsgBody)
|
||||||
.await
|
.await
|
||||||
.replace1(size)
|
.replace1(size)
|
||||||
|
|||||||
Reference in New Issue
Block a user