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.

Re-exportsยง

use std::fmt; ๐Ÿ”’
use std::fmt::Display; ๐Ÿ”’
use std::fmt::Formatter; ๐Ÿ”’
use std::fmt::Write; ๐Ÿ”’
use bytesize::ByteSize; ๐Ÿ”’
use serde::Deserialize; ๐Ÿ”’
use serde::Deserialize; ๐Ÿ”’
use serde::Deserializer; ๐Ÿ”’
use serde::de; ๐Ÿ”’
use crate::Result; ๐Ÿ”’
use crate::at; ๐Ÿ”’
use crate::err; ๐Ÿ”’

Structsยง

EscapedBytes ๐Ÿ”’

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.
escape_bytes
Renders bytes as text, writing each non-printable byte as \xHH.
from_str
Parse a human-writable size string w/ si-unit suffix into integer
increment
Increments an optional big-endian counter with wrapping arithmetic.
prefix_successor
Returns the least byte prefix strictly after every key with this prefix.
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