[][src]Crate pushbits

Push and pop the bit-packed fields.

It's common for network protocols to have bit-packed fields as a fixed width row in its header. Each fields have their own bit width, and its bit offset is defined as a sum of the widths of previous fields of the same row.

Traditionaly to set/extract those field one should manage both width and offset of the field. But since all the fields of this row are handled, the offset is a redaundant information we should not care ourselves.

That's where the pushbits came from. This crate provides fixed width bit container where you can push and pop the bits as a integer using bitshift left operation. If the widths are constant, the compiler optimize out all the overheads.



32bits container where you can push and pop multiple bits as a integer.