Skip to main content

read_packet

Function read_packet 

pub(super) async fn read_packet<R: AsyncRead + Unpin>(
    read: &mut R,
    reader: &mut PacketReader<GrowBuffer>,
) -> Result<Frame, Error>
Available on crate feature tokio only.
Expand description

Reads from read into reader until one whole packet is framed, returning its Frame. The packet remains buffered in reader (decode it with PacketReader::decode, then consume it). Any bytes read past it remain buffered too, so the same reader can be handed to the steady-state read loop without losing data.