VariableSize[A: Any val]¶
Length-prefixed data: a size codec determines how many bytes the body codec reads from. The size field is structural — it does not appear in the decoded type.
On decode: read the size, then decode the body from exactly that many bytes. On encode: encode the body, measure it, write the size, then the body.
Implements¶
- Codec[A] val
Constructors¶
create¶
Parameters¶
Returns¶
- VariableSize[A] val^
Public Functions¶
decode¶
Parameters¶
Returns¶
- ((A , USize val) | DecodeError)
encode¶
Parameters¶
- value: A
Returns¶
- (Array[U8 val] val | EncodeError)