Function read_packet
pub async fn read_packet<R: AsyncRead + Unpin>(
read: &mut R,
reader: &mut PacketReader<GrowBuffer>,
) -> Result<(FixedHeader, usize), Error>Expand description
Reads from read into reader until one whole packet is framed, returning
its fixed header and total on-wire length. The packet stays 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.