pub fn decode_message(data: &mut BytesMut) -> Result<(BackendMessage, usize)>Expand description
Decode a backend message from BytesMut without cloning
This version decodes in-place from a mutable BytesMut buffer and returns the number of bytes consumed. The caller must advance the buffer after calling this.
§Returns
Ok((msg, consumed)) - Message and number of bytes consumed
Err(e) - IO error if message is incomplete or invalid
§Performance
This version avoids the expensive buf.clone().freeze() call by working directly
with references, reducing allocations and copies in the hot path.