Skip to main content

parse_byte_size

Function parse_byte_size 

Source
pub fn parse_byte_size(s: &str) -> Result<u64, String>
Expand description

Parse a byte size: a bare integer (bytes) or an integer followed by a binary unit suffix (K/KiB/KB, M/MiB/MB, G/GiB/GB, all powers of 1024). Returns the size in bytes. The error is a String so it renders directly in clap’s value_parser diagnostics.