Skip to main content

Module bytes

Module bytes 

Source
Expand description

Byte-size parsing, display, and integer encoding helpers.

The module handles human-readable sizes alongside fixed-width big-endian counters. Its size deserializers integrate human-readable values with Serde.

Functions§

deserialize_bytesize_u64
Accepts an integer byte count or a string with SI/IEC suffix (e.g. “32 MiB”) and returns a u64.
deserialize_bytesize_usize
Accepts an integer byte count or a string with SI/IEC suffix (e.g. “24 MiB”) and returns a usize.
from_str
Parse a human-writable size string w/ si-unit suffix into integer
increment
Increments an optional big-endian counter with wrapping arithmetic.
pretty
Output a human-readable size string w/ iec-unit suffix
u64_from_bytes
Parses the big-endian bytes into an u64.
u64_from_u8
Parses 8 big-endian bytes into an u64; panic on invalid argument