Skip to main content

Module framing

Module framing 

Source

Functions§

decode_named
Decode named-field CBOR produced by encode_named.
encode_named
Encode value as named-field CBOR (the band’s canonical encoding).
encode_named_into
The in-place form of encode_named: clear and fill the caller’s buffer, so a hot loop reuses one allocation across encodes. Bytes identical to encode_named by construction (it delegates here), so there is still exactly one encoder.
frame_decode
Parse one frame from the front of buf. Ok(None) means the buffer does not yet hold a whole frame, so read more bytes. Ok(Some((payload, consumed))) is one payload and how many bytes of buf it spanned (4 + len). Errors when the length prefix exceeds MAX_FRAME_BYTES.
frame_encode
Frame payload as [len: u32 LE][payload]. Errors when the payload exceeds MAX_FRAME_BYTES.