format_bandwidth

Function format_bandwidth 

Source
pub fn format_bandwidth(bytes_per_sec: usize) -> String
Expand description

Format bytes per second in human-readable format (B/s, KB/s, MB/s, GB/s)

ยงExamples

use ipfrs_network::utils::format_bandwidth;

assert_eq!(format_bandwidth(1024), "1.00 KB/s");
assert_eq!(format_bandwidth(1_048_576), "1.00 MB/s");