Skip to main content

preamble_bytes

Function preamble_bytes 

Source
pub fn preamble_bytes(kind: FrameKind, header_len: u64) -> ([u8; 10], usize)
Expand description

A preamble for header_len bytes of header, and how many of the returned bytes are it.

Returned in a fixed array rather than pushed into a Vec, so a send path that already owns a buffer allocates nothing to write one: the frame’s length field precedes the header it measures, so the header has to be encoded first, and a caller that encodes it at MAX_PREAMBLE_LEN can then right-align this preamble against it and write one contiguous slice (B-250).