diff options
| author | mat <github@matdoes.dev> | 2021-12-10 00:54:58 -0600 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2021-12-10 00:54:58 -0600 |
| commit | be762fc5d37ba48386996afb4c5ba0c94aaf5883 (patch) | |
| tree | a7c96227c51e291e4e59eab7a66c6bc223973e06 /minecraft-protocol/src/packets/handshake | |
| parent | f64750afdd9b18379f706df66c32806b6d21bbe8 (diff) | |
| download | azalea-drasl-be762fc5d37ba48386996afb4c5ba0c94aaf5883.tar.xz | |
rust is driving me insane
Diffstat (limited to 'minecraft-protocol/src/packets/handshake')
| -rw-r--r-- | minecraft-protocol/src/packets/handshake/client_intention_packet.rs | 13 |
1 files changed, 11 insertions, 2 deletions
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<u8>) { @@ -26,5 +30,10 @@ impl<'a> PacketTrait for ClientIntentionPacket<'a> { mc_buf::write_varint(buf, self.intention.clone() as i32); } - fn parse<T: tokio::io::AsyncRead + std::marker::Unpin>(&self, buf: T) -> () {} + async fn read<T: tokio::io::AsyncRead + std::marker::Unpin + std::marker::Send>( + buf: &mut BufReader<T>, + ) -> Result<Packet<'_>, String> { + Err("ClientIntentionPacket::parse not implemented".to_string()) + // Ok(ClientIntentionPacket {}.get()) + } } |
