Function write_packet
pub(super) async fn write_packet<W: AsyncWrite + Unpin>(
buf: &mut Vec<u8>,
writer: &mut W,
packet: &Packet<'_>,
) -> Result<(), Error>Available on crate feature
tokio only.Expand description
Encodes packet into buf (clearing and reusing it), writes it to
writer, then flushes.
buf is a caller-owned scratch buffer. Reusing it across calls avoids a
heap allocation per packet.