This commit is contained in:
griffi-gh 2023-02-01 03:25:39 +01:00
parent 65ecf0de62
commit 8ff2a828ad

View file

@ -24,6 +24,7 @@ impl<S, R> Client<S, R> where S: Encode + Decode, R: Encode + Decode {
client.send_packet(&ClientPacket::Connect)?; client.send_packet(&ClientPacket::Connect)?;
Ok(client) Ok(client)
} }
//maybe move generics here if possible?
fn send_packet(&self, packet: &ClientPacket<S>) -> anyhow::Result<()> { fn send_packet(&self, packet: &ClientPacket<S>) -> anyhow::Result<()> {
let bytes = bincode::encode_to_vec(packet, BINCODE_CONFIG)?; let bytes = bincode::encode_to_vec(packet, BINCODE_CONFIG)?;
self.socket.send(&bytes)?; self.socket.send(&bytes)?;