pub fn format_bytes(bytes: i64) -> StringExpand description
Format bytes into human-readable string
Converts byte count into appropriate units (B, KB, MB, GB, TB) with one decimal place of precision.
§Arguments
bytes- Number of bytes to format
§Returns
Human-readable string (e.g., “15.3 GB”, “2.1 MB”)
§Examples
assert_eq!(format_bytes(1024), "1.0 KB");
assert_eq!(format_bytes(1536), "1.5 KB");
assert_eq!(format_bytes(1073741824), "1.0 GB");
assert_eq!(format_bytes(16106127360), "15.0 GB");