Trait binary_utils::PacketReader

source ·
pub trait PacketReader: Sized {
    // Required method
    fn read(
        reader: &mut (impl AsyncRead + Unpin),
        length: i32,
        packet_id: i32
    ) -> impl Future<Output = Result<Self>>;
}
Expand description

A trait for types that have to read Packet data

Required Methods§

source

fn read( reader: &mut (impl AsyncRead + Unpin), length: i32, packet_id: i32 ) -> impl Future<Output = Result<Self>>

Reads a packet from the provided stream reader using the specified id and length

§Arguments

reader - A mutable reference to a type implementing AsyncRead and Unpin length - the length of the packet (be careful, could be userdefined) packet_id - the id of the packet (packet type)

Object Safety§

This trait is not object safe.

Implementors§