From be762fc5d37ba48386996afb4c5ba0c94aaf5883 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 10 Dec 2021 00:54:58 -0600 Subject: rust is driving me insane --- .../src/packets/handshake/client_intention_packet.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'minecraft-protocol/src/packets/handshake') diff --git a/minecraft-protocol/src/packets/handshake/client_intention_packet.rs b/minecraft-protocol/src/packets/handshake/client_intention_packet.rs index 7dd358eb..401dbbac 100644 --- a/minecraft-protocol/src/packets/handshake/client_intention_packet.rs +++ b/minecraft-protocol/src/packets/handshake/client_intention_packet.rs @@ -1,5 +1,8 @@ use std::hash::Hash; +use async_trait::async_trait; +use tokio::io::BufReader; + use crate::{ mc_buf, packets::{ConnectionProtocol, Packet, PacketTrait}, @@ -14,9 +17,10 @@ pub struct ClientIntentionPacket<'a> { pub intention: ConnectionProtocol, } +#[async_trait] impl<'a> PacketTrait for ClientIntentionPacket<'a> { fn get(&self) -> Packet { - Packet::ClientIntentionPacket(self) + Packet::ClientIntentionPacket(*self) } fn write(&self, buf: &mut Vec) { @@ -26,5 +30,10 @@ impl<'a> PacketTrait for ClientIntentionPacket<'a> { mc_buf::write_varint(buf, self.intention.clone() as i32); } - fn parse(&self, buf: T) -> () {} + async fn read( + buf: &mut BufReader, + ) -> Result, String> { + Err("ClientIntentionPacket::parse not implemented".to_string()) + // Ok(ClientIntentionPacket {}.get()) + } } -- cgit v1.2.3