Skip to main content

parse_size

Function parse_size 

Source
pub fn parse_size(input: &str) -> Result<u64>
Expand description

Parse a human-readable size string into a byte count.

Accepts:

  • Plain numbers: 1024 → 1024 bytes
  • SI: K, M, G, T (1000-based)
  • Binary: Ki, Mi, Gi, Ti (1024-based)
  • With an optional trailing B (e.g. 1Gi, 1GiB)
  • Case-insensitive; whitespace between digits and unit is ignored