Module bytes

Source

Functionsยง

io_write_u32_le
Like write_u32_le, but to an io::Write implementation. If every byte could not be writen, then this returns an error.
io_write_u64_le
Like write_u64_le, but to an io::Write implementation. If every byte could not be writen, then this returns an error.
pack_size
pack_size returns the smallest number of bytes that can encode n.
pack_uint
pack_uint packs the given integer in the smallest number of bytes possible, and writes it to the given writer. The number of bytes written is returned on success.
pack_uint_in
pack_uint_in is like pack_uint, but always uses the number of bytes given to pack the number given.
read_u32_le
Read a u32 in little endian format from the beginning of the given slice. This panics if the slice has length less than 4.
read_u64_le
Read a u64 in little endian format from the beginning of the given slice. This panics if the slice has length less than 8.
unpack_uint
unpack_uint is the dual of pack_uint. It unpacks the integer at the current position in slice after reading nbytes bytes.
write_u32_le
Write a u32 in little endian format to the beginning of the given slice. This panics if the slice has length less than 4.
write_u64_le
Write a u64 in little endian format to the beginning of the given slice. This panics if the slice has length less than 8.