Crates.io | parse-size |
lib.rs | parse-size |
version | 1.1.0 |
source | src |
created_at | 2021-05-04 07:53:15.297296 |
updated_at | 2024-09-17 08:01:01.109143 |
description | Parse byte size into integer accurately. |
homepage | |
repository | https://github.com/kennytm/parse-size |
max_upload_size | |
id | 392874 |
size | 26,504 |
parse-size
is an accurate, customizable, allocation-free library for
parsing byte size into integer.
use parse_size::parse_size;
assert_eq!(parse_size("0.2 MiB"), Ok(209715));
assert_eq!(parse_size("14.2e+8"), Ok(14_2000_0000));
parse-size
can accurately parse the input using the full 64-bit precision.1 KiB
= 1 kib
= 1Ki
).2.5 KiB
= 2560
, 2.5B
= 3
).123_456
= 123456
).#![no_std]
-capable, no dependencies, and uses no heap allocation.