pub fn encode_message(
msg: &MessageType,
buf: &mut [u8],
) -> Result<usize, ProtocolError>
Expand description
Writes a header-prefixed message to a byte slice, and returns the number of bytes used. Returns ProtocolError::ShortBuffer if the slice doesn’t have enough capacity.