Skip to main content

read_message

Function read_message 

Source
pub async fn read_message(
    recv: &mut RecvStream,
) -> Result<Option<(u8, Bytes)>, PyroLinkError>
Expand description

Read one framed message from the stream.

Reads the 1-byte type tag and 4-byte LE length, then reads exactly that many bytes of payload. Returns None if the stream signals EOS (0xFF type byte).

§Errors

Returns PyroLinkError::Framing if the length field overflows or the stream ends prematurely.