pub fn parse_bytes(input: &str) -> Result<u64, ByteSizeParseError>Expand description
Parses a byte size such as 32MiB, 1.5GiB, 512 kB, or 1024.
Both unit families are accepted regardless of the configured display family,
because a configuration file is written by a person who may not know which
family is active. IEC and SI suffixes are distinguished by the i: MiB is
1024², MB is 1000². A bare number is bytes — unlike a duration, where a
bare number is genuinely ambiguous, “bytes” is the only sensible default here.
A single decimal fraction is accepted, so anything format_bytes renders can
be pasted back. The fraction is applied with integer arithmetic rather than
floating point: 1.5GiB is exactly 1610612736 bytes, not a value that depends
on rounding.