format_bytes

Function format_bytes 

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

What: Format bytes into human-readable string with appropriate unit.

Inputs:

  • value: Number of bytes to format.

Output:

  • Returns a formatted string like “1.5 MiB” or “1024 B”.

Details:

  • Uses binary units (KiB, MiB, GiB, etc.) and shows integer for bytes < 1024, otherwise 1 decimal place.