use bincode::{Encode, Decode}; use crate::common::ClientId; #[repr(u8)] #[derive(Encode, Decode)] pub enum ClientPacket where T: Encode + Decode { Data(T), Connect, Disconnect, Heartbeat, } #[derive(Encode, Decode)] pub struct IdClientPacket(pub Option, pub ClientPacket); #[repr(u8)] #[derive(Encode, Decode)] pub enum ServerPacket where T: Encode + Decode { Data(T), Connected(ClientId), Disconnected(String), } #[derive(Encode, Decode)] pub struct IdServerPacket(pub Option, pub ServerPacket);