Function framed::encode_to_slice [] [src]

pub fn encode_to_slice(p: &Payload, dest: &mut [u8]) -> Result<usize>

Encode the supplied payload data as a frame at the beginning of the supplied buffer dest.

Returns the number of bytes it has written to the buffer.

Panics

This function will panic if dest is not large enough for the encoded frame. Ensure dest.len() >= max_encoded_len(p.len()).