Skip to main content

encode_kvp_delta_pair

Function encode_kvp_delta_pair 

Source
fn encode_kvp_delta_pair(
    prev_key: &mut u64,
    pair: &KeyValuePair,
    buf: &mut impl BufMut,
) -> Result<(), CodecError>
Expand description

Write one Key-Value-Pair, encoding its Type as a delta from prev_key and advancing prev_key to this pair’s Type.

Refuses a Type below the one before it. The delta is an unsigned difference, so a descending pair wraps the subtraction into a nine-byte delta that the peer resolves to an unrelated Type — the codec would put a frame on the wire that its own decoder reads as something else entirely.