Skip to main content

read_frame

Function read_frame 

Source
pub fn read_frame<R: Read, T: for<'de> Deserialize<'de>>(
    reader: &mut R,
) -> Result<Option<T>, FrameError>
Expand description

Read one frame and parse it.

Returns Ok(None) when the stream ends cleanly between frames, which is how a peer that has finished is told apart from one that died mid-message.

ยงErrors

Fails on a truncated frame, an oversized or unknown-encoding header, a payload that does not parse, or a stream error.