Expand description
Minimal msgpack encoder/decoder for Resource advertisements and HMU packets.
Supports the subset needed by Reticulum’s Resource protocol:
- Nil, Bool, positive/negative fixint, uint8-64, int8-32
- fixstr, str8
- bin8, bin16, bin32
- fixarray, array16
- fixmap, map16
Structs§
- Entries
- Entries of a validated map.
- Items
- Items of a validated array (or keys and values of a map, in order).
Enums§
- Error
- Msgpack error.
- Value
- A msgpack value.
- Value
Ref - A decoded msgpack value borrowing from its input. Arrays and maps are
validated when decoded (formats, nesting depth, UTF-8) and keep their
encoded items, which
ValueRef::array_itemsandValueRef::map_entriesdecode on demand.
Functions§
- pack
- Encode a Value to msgpack bytes.
- pack_
array_ header - Append the header of an array of
lenitems, aspackwrites it. - pack_
bin_ into - Append binary data, as
packwritesValue::Bin. - pack_
ref_ into - Append a value decoded by
unpack_refexactly aspackwrites theValuethatunpackdecodes from the same bytes. - pack_
str_ map - Convenience: pack a map from string keys.
- unpack
- Decode a single msgpack value from the start of
data. Returns (value, bytes_consumed). - unpack_
exact - Decode a complete msgpack value, ensuring no trailing data.
- unpack_
exact_ ref - Decode a complete msgpack value without copying it, ensuring no trailing
data. Accepts and rejects exactly the inputs
unpack_exactdoes. - unpack_
ref - Decode one value from the start of
datawithout copying, returning it and the bytes consumed. Nested arrays and maps are validated in full.