format_size

Function format_size 

Source
pub fn format_size(bytes: u64, human_readable: bool) -> String
Expand description

Format bytes into string with optional human-readable scaling

§Arguments

  • bytes - The size in bytes to format
  • human_readable - If true, formats with appropriate scale (B, KB, MB, GB, TB) If false, returns raw bytes with “bytes” suffix

§Examples

use acme_disk_use::format_size;

assert_eq!(format_size(1024, true), "1.00 KB");
assert_eq!(format_size(1024, false), "1024 bytes");