Skip to main content

encode_limited_without

Function encode_limited_without 

Source
pub fn encode_limited_without<T: Serialize>(
    value: &T,
    keys: &[&str],
    limit: usize,
) -> Result<Vec<u8>, CodecError>
Expand description

encode_limited, with every map entry whose key is one of keys left out, at any depth: a reply with a field the connection did not agree to (spoolframe:rating-sources).

The value is encoded as usual, within limit. Only when the bytes hold one of keys (a CBOR text key is its bytes as they are, so a scan for them misses none, and a stray match only costs the slow path) are they read into CBOR’s own tree, stripped and encoded again: that covers every shape without knowing any of them, and the tree is never larger than limit allows. A value without them is the very bytes encode_limited gives.