Skip to main content

format_memory

Function format_memory 

Source
pub fn format_memory(bytes: i64) -> String
Expand description

Format a byte count as a human-readable memory string using binary suffixes.

Picks the largest binary unit that divides the value exactly so a non-negative result round-trips through parse_memory; a value that is not an exact multiple of any unit (e.g. 1536) is rendered as raw bytes rather than truncated. Negative inputs (which parse_memory rejects) render as raw signed integers.