Trait durian::PacketBuilder

source ·
pub trait PacketBuilder<T: Packet> {
    // Required method
    fn read(&self, bytes: Bytes) -> Result<T, Box<dyn Error>>;
}
Expand description

PacketBuilder is the deserializer for Packet and used when PacketManager receives bytes

This is automatically implemented if using the macros bincode_packet, BinPacket, or UnitPacket.

Required Methods§

source

fn read(&self, bytes: Bytes) -> Result<T, Box<dyn Error>>

Deserializes Bytes into the Packet this PacketBuilder is implemented for

Error

Returns an error if deserializing fails

Implementors§