-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ec47fa
commit 71d1ee9
Showing
3 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
pkgs/by-name/cl/clash-verge-rev/0001-enable-format_bytes_speed-for-every-platform.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/src/utils/help.rs b/src/utils/help.rs | ||
index 9b0bc6a7..471b2adc 100644 | ||
--- a/src/utils/help.rs | ||
+++ b/src/utils/help.rs | ||
@@ -201,16 +201,6 @@ macro_rules! t { | ||
}; | ||
} | ||
|
||
-/// 将字节数转换为可读的流量字符串 | ||
-/// 支持 B/s、KB/s、MB/s、GB/s 的自动转换 | ||
-/// | ||
-/// # Examples | ||
-/// ``` | ||
-/// assert_eq!(format_bytes_speed(1000), "1000B/s"); | ||
-/// assert_eq!(format_bytes_speed(1024), "1.0KB/s"); | ||
-/// assert_eq!(format_bytes_speed(1024 * 1024), "1.0MB/s"); | ||
-/// ``` | ||
-#[cfg(target_os = "macos")] | ||
pub fn format_bytes_speed(speed: u64) -> String { | ||
if speed < 1024 { | ||
format!("{}B/s", speed) | ||
@@ -222,6 +212,15 @@ pub fn format_bytes_speed(speed: u64) -> String { | ||
format!("{:.1}GB/s", speed as f64 / 1024.0 / 1024.0 / 1024.0) | ||
} | ||
} | ||
+/// 将字节数转换为可读的流量字符串 | ||
+/// 支持 B/s、KB/s、MB/s、GB/s 的自动转换 | ||
+/// | ||
+/// # Examples | ||
+/// ``` | ||
+/// assert_eq!(format_bytes_speed(1000), "1000B/s"); | ||
+/// assert_eq!(format_bytes_speed(1024), "1.0KB/s"); | ||
+/// assert_eq!(format_bytes_speed(1024 * 1024), "1.0MB/s"); | ||
+/// ``` | ||
|
||
#[test] | ||
fn test_format_bytes_speed() { | ||
-- | ||
2.47.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters