Expand description
A decoded control message as a tree of named fields.
AnyControlMessage::fields
turns any draft’s ControlMessage into a FieldMap whose keys are the
field names that draft gives them. The names are the drafts’ own, in
snake_case, and the field order is the order the draft defines — so a
reader that has never heard of a message can still show it, and two drafts
that spell the same concept differently keep their own spelling. The
per-draft fields modules are what it dispatches to.
§Why a tree of the crate’s own making
The obvious return types are serde_json::Value and ciborium::Value, and
this crate depends on neither. A codec that gained a serialization format’s
value type would make everything downstream carry it, to describe messages
that have nothing to do with that format. FieldValue is std and a
Vec, and each caller renders it into whatever it already writes: the
vector tests into JSON, where a varint becomes a decimal string and a byte
string becomes hex, and a trace writer into CBOR, where both have a type of
their own.
That split is also why FieldValue::Uint and FieldValue::Bytes are
distinct from FieldValue::Text rather than pre-rendered into it. A
converter that flattened them would force every consumer to guess which
strings were numbers.
Structs§
- Field
Map - A decoded message’s fields, in the order the draft defines them.
Enums§
- Field
Value - One field’s value inside a decoded control message.