Skip to main content

Module codec

Module codec 

Source
Expand description

Postcard codec for Frame.

On the wire every BiBeam message is laid out as:

MAGIC (4 bytes) || VERSION (1 byte) || postcard-serialised Frame

encode produces that exact byte layout. decode validates both MAGIC and VERSION before invoking the postcard deserializer and surfaces the two bad-prefix cases as first-class ProtocolError::BadMagic and ProtocolError::BadVersion variants, so callers do not need to string-sniff a generic codec error to find the root cause.

Functionsยง

decode
Decode a wire buffer into a Frame.
encode
Encode frame into the canonical BiBeam wire layout.