Skip to main content

Module msgpack

Module msgpack 

Source
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.
ValueRef
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_items and ValueRef::map_entries decode on demand.

Functions§

pack
Encode a Value to msgpack bytes.
pack_array_header
Append the header of an array of len items, as pack writes it.
pack_bin_into
Append binary data, as pack writes Value::Bin.
pack_ref_into
Append a value decoded by unpack_ref exactly as pack writes the Value that unpack decodes 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_exact does.
unpack_ref
Decode one value from the start of data without copying, returning it and the bytes consumed. Nested arrays and maps are validated in full.