Module uint_bytes

Source
Expand description

Serialization (and deserialization) of primitive unsigned integer types to (and from) an arbitrary fixed-length byte array.

Macrosยง

bytes_serde_impl ๐Ÿ”’
Impl serde for type $T with methods named $to_bytes, $from_bytes of the form
uint_bytes_impl ๐Ÿ”’

Functionsยง

u32_fits
Can n fit into byte_len bytes?
u32_from_bytes
Deserialize bytes in little-endian form into a $T, padding with 0 as needed.
u32_max_from_byte_len
Return the largest $T value that can fit into byte_len bytes.
u32_to_bytes
Serialize n into BYTE_LEN bytes in little-endian form, padding with 0 as needed.
usize_fits
Can n fit into byte_len bytes?
usize_from_bytes
Deserialize bytes in little-endian form into a $T, padding with 0 as needed.
usize_max_from_byte_len
Return the largest $T value that can fit into byte_len bytes.
usize_to_bytes
Serialize n into BYTE_LEN bytes in little-endian form, padding with 0 as needed.