Skip to main content

format_human_size

Function format_human_size 

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

Format a byte count as a human-readable size.

Uses base-10 units: KB (10^3), MB (10^6), GB (10^9).

Examples:

  • 0"0 B"
  • 1023"1023 B"
  • 1024"1.0 KB"
  • 1_500_000"1.5 MB"
  • 2_500_000_000"2.5 GB"