Skip to main content

label_decode_spec

Function label_decode_spec 

Source
pub fn label_decode_spec(source: &RawLabelSource) -> Option<LabelDecodeSpec>
Expand description

Derives the label decode description a frame must carry for this binding.

A primary-key binding reduces to exactly what decoding reads: the metric name, the primary-key encoding, the ordered key columns with their physical types, and the logical tags. Region metadata guarantees the key list holds every tag column and nothing else, so the description needs no per-column role. Explicit bindings already carry complete labels and declare no description.

The result is canonical: its logical tags are in [LabelDecodeSpec::canonicalize] order, which is what the writer serializes, so a derived description and a received one for the same labels are the same value and the same text. Derivation cannot fail, because a physical type is copied rather than translated; a description a reader cannot honour is rejected when it is read, and a decoder rejects the tags it cannot bind.