Skip to main content

encode

Function encode 

Source
pub fn encode(
    msg_type: MessageType,
    flags: FrameFlags,
    request_id: RequestId,
    payload: &[u8],
) -> Result<Vec<u8>, ProtocolError>
Expand description

Encode a frame into a contiguous buffer.

Allocation: exactly one Vec.

ยงErrors

Returns ProtocolErrorKind::PayloadTooLarge if payload.len() exceeds MAX_PAYLOAD_SIZE (1 MiB).