How-to guides

These guides solve specific tasks. Each page is self-contained and runnable on its own; they assume you can already define, pack, and unpack a basic rustruct.Struct – complete 1. Install rustruct first if those operations are unfamiliar.

Choose a field type

Pick a field by the value your application should receive and how its wire width is determined: fixed-width scalars, exact or runtime-sized bytes, encoded text, a converted Python value, or a computed checksum.

Model collections and nesting

Choose counted arrays when the wire carries an element count, greedy arrays when a surrounding region supplies the endpoint, and rustruct.sized() when a nested message has its own byte-length field.

Model enums and bit fields

Model computed and conditional fields

Model tagged unions

Choose or extend an API layer

Use bundled formats

Measure performance