pub fn encode_presized<T: Serialize>(
value: &T,
bulk_bytes: usize,
) -> Result<Vec<u8>>Expand description
encode, for a message carrying bulk_bytes bytes of bulk payload.
The encoder writes into a Vec that would otherwise start empty and
reallocate as it grows — 10–80% of the encode cost on dora’s messages, worst
on the small control messages that dominate the daemon↔node TCP path. Pass
encode_size_hint(), which the message types that carry a payload provide;
the envelope slack is added here so that policy lives in one place.