Capsize provides conversions between units of capacity, similar in nature to Duration, which provides conversions between units of time.
All conversions are represented as an
i64 by default.
This crate also provides FromStr implementations that parse values "1k" into
their corresponding capacity in
i64 format in bytes.
use capsize::Capacity; // convert to kilobytes to bytes let bytes = 4.kilobytes(); assert_eq!(bytes, 4096); // resolve 4096 to the closest human readable form assert_eq!(bytes.capacity(), "4.0K");
Bytes is a simple type to extract a capacity size, in bytes, from a string value
Capacity provides a simple way to convert values to corresponding units of capacity