format_bytes

Function format_bytes 

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

Format bytes as human-readable size

Converts byte count to KB, MB, GB, etc.

ยงExample

assert_eq!(format_bytes(0), "0 B");
assert_eq!(format_bytes(1024), "1.00 KB");
assert_eq!(format_bytes(1_048_576), "1.00 MB");
assert_eq!(format_bytes(1_073_741_824), "1.00 GB");