pub fn read_msg<R: Read, T: for<'de> Deserialize<'de>>(r: &mut R) -> Result<T>Expand description
Read a length-prefixed CBOR-encoded message. Caps the frame at
MAX_FRAME_BYTES so a malformed prefix can’t trigger an
unbounded allocation.
Thin wrapper over read_frame that collapses
Framed::Undecodable back into io::ErrorKind::InvalidData
with serde’s message — byte-identical to what this function
returned before read_frame existed, so every existing caller
keeps its behaviour. A caller that wants to answer an unknown
variant instead of hanging up should call read_frame
directly; tear-daemon’s serve loop does.
§Errors
io::Error on transport failure, EOF, an oversized length
prefix, or a payload that does not decode into T.