azalea_protocol::read

Function try_read_packet

Source
pub fn try_read_packet<P: ProtocolPacket + Debug, R>(
    stream: &mut R,
    buffer: &mut BytesMut,
    compression_threshold: Option<u32>,
    cipher: &mut Option<Aes128CfbDec>,
) -> Result<Option<P>, Box<ReadPacketError>>
where R: AsyncRead + Unpin + Send + Sync,
Expand description

Try to read a single packet from a stream. Returns None if we haven’t received a full packet yet.