Expand description
Tagged-map msgpack deserializer that wraps [rmp_serde::Deserializer].
Mirrors crate::serializer::Serializer: each aggregate shape that the
macro emits — named struct, multi-element tuple struct, sequence, tuple,
map, option, newtype struct — is intercepted to translate integer wire
tags back to the serde field/variant names the Visitor expects, via
the TagRegistry.
The public entry point is msgpack_tagged_deserialize, which builds
the registry up front via T::register_into and runs the bytes through
the wrapper.
§Known gaps vs. the design doc / macro syntax
The wrapper isn’t final — the bits below are accepted by
#[derive(MsgpackTagged)] today but the deserializer doesn’t model
them yet.
deserialize_any. Niche today (none of our ACIR types are decoded via self-describing visitors), but nested tagged values reached throughserde_json::Value-style consumers wouldn’t recurse through this wrapper.- Encoding strategies. Only the Tagged strategy is decoded. When the serializer gains Array / Named overrides, the deserializer needs the matching shape-agnostic dispatch (peek marker, route to the right reader).
Structs§
- Array
Product 🔒MapAccess MapAccessadapter for named structs decoded from the Array strategy wire shape (positionalfixarrayof values). UnlikeTaggedProductMapAccessthe wire carries no tags; we synthesize the keys yielded to the visitor by walking the merged (active + reserved) wire layout — seemerged_wire_layoutfor why the merge is needed. The visitor still receives(field_name, value)pairs — that’s how serde-derive’sDeserializefor named structs is driven — but the field-name source is the registry, not the wire.- Deserializer
- Tagged-map msgpack deserializer.
- Tagged
Access 🔒ViaParent - Shared access adapter routing each yielded value through the parent
Deserializer. The msgpack length-prefixed header (array length for sequences, map length for maps) is consumed up front in the correspondingdeserialize_*method before this adapter is built; from there each element/key/value just reads its own bytes through the parent, so any nested tagged values still see this wrapper’s interception. - Tagged
Enum 🔒Access EnumAccess+VariantAccessadapter for tagged enums.- Tagged
Product 🔒MapAccess MapAccessadapter for tagged structs (and tuple structs once that lands). The wire is an int-keyed msgpack map — each entry’s key is an integer tag that we translate back to the registered field name before handing it to the visitor (which expects a string identifier). Tags not inproduct.fieldsare either silently skipped (allow_unknown_tags = true) or rejected (the strict default).- Tagged
Tuple 🔒Struct Access SeqAccessadapter for top-level tuple structs (multi-elementstruct Pair(u32, bool)shapes). Decoded by tag, not by wire order: every wire entry is buffered as(tag, value-bytes)upfront, and on eachnext_element_seedwe look up the tag corresponding to the current source position viaProduct.tag_for("0"),tag_for("1"), … and re-deserialize the matching entry’s bytes through a freshly constructed sub-wrapper (so any nested tagged types still see this wrapper’s interception).
Enums§
- Wire
Shape 🔒 - Wire shape of a product value under
Format::MsgpackTagged. Picked per struct at decode time by peeking the next msgpack marker — theSerializerchoice ofEncodingStrategyis not communicated through a separate channel (and doesn’t need to be: the shape is self-describing at the msgpack-header level).
Functions§
- merged_
wire_ 🔒layout - Merge
product.fieldsandproduct.reservedinto a single tag-ascending list of(tag, is_active)pairs. - msgpack_
tagged_ deserialize - Build the tag registry from
T::register_into, then deserialize a value of typeTfrombytesthrough aDeserializer.
Type Aliases§
- IntKeyed
Entries 🔒 - Buffered
(wire_tag, value-bytes)pairs from an int-keyed map. Inline capacity 4 covers the typical tuple-struct / tuple-variant arity without a heap allocation; anything larger transparently spills. - RmpError 🔒
rmp_serde’s decode-side error type, re-exported for ourDeserializerimpl. Matches the encode-sideRmpErrorre-export inserializer.rs.