Skip to main content

Module bitfield

Module bitfield 

Source
Expand description

Bit-level read and write cursors.

BitReader consumes bits from a borrowed byte slice in most-significant-bit first order, suitable for packed binary protocols where multiple fields share a single byte. BitWriter performs the reverse operation against a caller- supplied output buffer.

Both cursors support arbitrary widths from 1 to 64 bits per call.

Structs§

BitReader
Reads packed bits from a borrowed byte slice, most-significant-bit first.
BitWriter
Writes packed bits to a caller-supplied byte slice, most-significant-bit first.

Constants§

MAX_BIT_WIDTH
Maximum bit width per read_bits / write_bits call.