Skip to main content

encode_chunk_frame_headers

Function encode_chunk_frame_headers 

Source
pub fn encode_chunk_frame_headers(
    payload_len: usize,
    out: &mut [u8; 11],
) -> Result<usize, MessageValidationError>
Expand description

Encode the full frame headers for a ChunkData payload of payload_len bytes: the framing varint postcard_len followed by the ChunkData header (discriminant + varint payload_len). The payload itself is not included — the caller sends it as Bytes alongside this header via a vectored write.

Returns the number of header bytes written into out (≤ CHUNK_FRAME_HEADERS_MAX).

§Errors

MessageValidationError::EmptyChunk for payload_len == 0, or MessageValidationError::ChunkTooLarge if the frame would exceed crate::framing::MAX_MESSAGE_SIZE.