pub fn encode_frame(payload: &[u8], max: usize) -> Result<Vec<u8>, FrameError>Expand description
Encode a payload as a length-prefixed frame: 4-byte big-endian length
followed by the payload. Returns an error if the payload exceeds max
or cannot be represented in a u32 length.