Skip to main content

write_framed

Function write_framed 

Source
pub async fn write_framed<W>(w: &mut W, tag: u8, payload: &[u8]) -> Result<()>
where W: AsyncWrite + Unpin,
Expand description

Send one frame: tag, then a four-byte big-endian length, then payload.

Public so a protocol riding on the same framing — the pairing exchange — writes with it rather than growing a second copy of the format. The payload is bounded by MAX_FRAME_LEN and flushed before returning.