Skip to main content

insert_parameter

Function insert_parameter 

Source
pub fn insert_parameter(
    parameters: &mut Vec<KeyValuePair>,
    parameter: KeyValuePair,
)
Expand description

Put parameter into parameters at the position ascending type order requires.

Section 10.2 makes the order a wire rule — “Parameters MUST be serialized in ascending order by Type” — and the codec’s encoder refuses a descending pair rather than emitting one, so a caller appending a LOCATION_FILTER to a list that already holds a higher type would otherwise get an error from the encoder instead of a message.

A parameter of a type already present is inserted after the ones already there, which is the only placement that keeps a repeatable filter’s instances in the order they were added.