Skip to main content

read_message

Function read_message 

Source
pub fn read_message<R, T>(r: &mut R) -> Result<Option<T>>
where R: Read, T: DeserializeOwned,
Expand description

Read a length-prefixed JSON message from a stream.

Wire format: [u8; 4] little-endian length, then length bytes of UTF-8 JSON. Returns Ok(None) on clean EOF, Err on truncated reads or malformed JSON.