pub fn encode_packet_data(
buf: &mut Vec<u8>,
packet_id: i32,
encode_fn: impl FnOnce(&mut Vec<u8>),
)Expand description
Encode a typed packet into raw bytes (packet ID + fields), without framing.
Clears buf and writes the packet ID followed by the encoded fields into
it. The caller should supply a reusable buffer so that its capacity is
retained across calls, avoiding per-packet allocations.