Skip to main content

format_bytes_speed

Function format_bytes_speed 

Source
pub fn format_bytes_speed(bytes: u64) -> String
Expand description

Formats bytes per second into a human-readable string.

§Arguments

  • bytes - Number of bytes per second

§Returns

A formatted string with appropriate units (B/s, KB/s, or MB/s).

§Example

assert_eq!(format_bytes_speed(1_500_000), "1.5 MB/s");
assert_eq!(format_bytes_speed(1_500), "1.5 KB/s");