Skip to main content

encode_map_header

Function encode_map_header 

Source
pub fn encode_map_header(out: &mut Vec<u8>, count: i64)
Expand description

%<count>\r\n — a map header. Follow with count × 2 sub-replies (key₁ value₁ key₂ value₂ …). The count is the pair count, not the element count.

Used for replies that RESP2 ships as *2N array-of-pairs — HGETALL, CONFIG GET, XINFO STREAM. The map header is a single byte plus the count digits; vs RESP2’s *2N it saves zero header bytes but the payload typically saves 4 B per pair by allowing simple-string keys.