Skip to main content

Module utils

Module utils 

Source

Structs§

ByteSize
Helper struct that wraps a byte count and improves its std::fmt::Debug formatting. Formats the value as a human-readable size, automatically selecting the most appropriate unit (B, KiB, MiB, GiB, TiB). Trailing fractional zeros are omitted, and exact multiples of a unit are printed without a decimal point entirely.
HexI8
Helper struct that wraps a i8 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of i8. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexI16
Helper struct that wraps a i16 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of i16. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexI32
Helper struct that wraps a i32 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of i32. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexI64
Helper struct that wraps a i64 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of i64. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexU8
Helper struct that wraps a u8 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of u8. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexU16
Helper struct that wraps a u16 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of u16. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexU32
Helper struct that wraps a u32 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of u32. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
HexU64
Helper struct that wraps a u64 and improves its std::fmt::Debug formatting. Formats the value as a zero-padded hexadecimal number with a 0x prefix, padded to the full bit-width of u64. Signed types are cast to their unsigned counterpart before formatting, giving the two’s complement representation without a sign prefix.
PrettyBytes
Helper struct that wraps a byte slice and improves its std::fmt::Debug formatting. Printable ASCII characters are rendered as-is; non-printable bytes are escaped as \xNN. Matches the formatting convention of the bytes::Bytes type for consistency across logs.

Functions§

contains_null
next_prefix