pub fn encode_message<T: Serialize>(msg: &T) -> Result<BytesMut, ProtocolError>Expand description
Serialize a message to a length-prefixed byte buffer with protocol version.
Format: [4-byte LE length][4-byte LE protocol version][bincode payload]
The length field covers the protocol version + payload bytes.
ยงErrors
Returns an error if serialization fails.