Function grep_cli::parse_human_readable_size
source ยท pub fn parse_human_readable_size(size: &str) -> Result<u64, ParseSizeError>
Expand description
Parse a human readable size like 2M
into a corresponding number of bytes.
Supported size suffixes are K
(for kilobyte), M
(for megabyte) and G
(for gigabyte). If a size suffix is missing, then the size is interpreted
as bytes. If the size is too big to fit into a u64
, then this returns an
error.
Additional suffixes may be added over time.