pub fn decode_frame<T: for<'de> Deserialize<'de>>(
buf: &[u8],
) -> Result<Option<(T, usize)>, Error>Expand description
Decode one frame from a byte slice.
Returns Ok(None) if the buffer does not yet contain a complete
frame (the caller should read more bytes and retry). Returns
Err(InvalidData) if the declared length exceeds MAX_BODY_SIZE
— this prevents a malicious client from forcing the server to
allocate gigabytes for a body that will never arrive.