pub fn decode_fill_parameters(
value: &[u8],
) -> Result<Vec<KeyValuePair>, CodecError>Expand description
Decode the nested parameter block a FILL_PARAMETERS value carries.
§The value begins with a Number of Parameters count
Section 10.2.15 says the value is “a sequence of Parameters that apply to the fill fetch stream” and is “encoded as if they were Parameters for a separate message”, and stops there. This codec reads that as the full block, count included. The draft does not state it either way, and the wrong choice desynchronises the whole outer parameter list rather than producing a recognisable error, so it is worth naming: Section 10.2 defines a parameter block as count-bounded — “Because unknown parameters cannot be skipped, the block is bounded by a parameter count rather than a length” — and the phrase Parameters for a message denotes that block everywhere else in Section 10. The outer length prefix is the generic length-prefixed value encoding every such parameter gets and says nothing about the value’s internal structure.
So an empty FILL_PARAMETERS — the common case, a fill with every setting
inherited from the subscription — is Length = 1 carrying the single byte
0x00, and not Length = 0.
§The Type Delta chain restarts here, and the outer chain is unaffected
Section 10.2.15: “The value of FILL_PARAMETERS is a separate parameter
scope. Parameters inside it are not considered to appear in the enclosing
message for the purposes of Section 10.2, so a Parameter Type MAY appear
both in the message and inside FILL_PARAMETERS.” Section 10.2 defines
Type Delta as the difference from “the previous Parameter Type in the
message”, and a separate scope is not the message — so the inner chain
starts from 0, and the outer parameter after FILL_PARAMETERS deltas from
0x23 rather than from the last inner type. The draft states neither
half explicitly; both are decided here.
§What it refuses
A type outside Table 6 is CodecError::ParameterOutOfScope, reported
against FILL_PARAMETERS itself because the nested scope is the “message”
the parameter appeared in. A type draft-20 does not define at all is
CodecError::UnknownMessageParameter, checked first so an unknown type is
not reported as a known one in the wrong place.