| Crates.io | prefix_parser |
| lib.rs | prefix_parser |
| version | 0.1.1 |
| created_at | 2025-07-07 10:49:10.622109+00 |
| updated_at | 2025-07-08 06:34:44.335327+00 |
| description | A parser for numbers with binary prefixes on the end. EX: Turning 1KB into 1000. |
| homepage | |
| repository | https://github.com/Jacoblightning/prefix_parser |
| max_upload_size | |
| id | 1741027 |
| size | 30,449 |
A parser for numbers with a binary/SI prefix on the end.
call prefix_parser::parse_prefixes with the prefixed number to parse.
let parsed = prefix_parser::parse_prefixes("216MiB")?;
// 226492416 == 1024^2 * 216, so 226492416 is 216MiB
assert_eq!(parsed, 226492416);
MB vs MiB, KB vs KiB, etc...1k is 1024, not 1000).b, bb, and bib are allowed and valid, although they just keep the number as is.