pub fn parse_bytes(s: &str) -> Option<u64>Expand description
Parses human-readable sizes (e.g. "5MB", "10KB", "2GB") into a raw byte count (u64).
Case-insensitive, supports optional space, and treats unit-less values as bytes.
All units are binary (1024-based). The two-letter (kb), single-letter (k), and
binary-explicit (ki) spellings are accepted as aliases for the same power of 1024.
ยงExamples
use rskit_util::bytes::parse_bytes;
assert_eq!(parse_bytes("512"), Some(512));
assert_eq!(parse_bytes("1 KB"), Some(1024));
assert_eq!(parse_bytes("5mb"), Some(5242880));
assert_eq!(parse_bytes("2Mi"), Some(2 * 1024 * 1024));