From 567c6f4f2c39976d170111b816806453636f8241 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 1 May 2022 21:54:03 -0500 Subject: Reduce usage of AsyncRead We already receive everything from the server when it tells us the length, so we can actually just treat the stream as a Read instead of an AsyncRead. --- azalea-protocol/src/mc_buf/write.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'azalea-protocol/src/mc_buf/write.rs') diff --git a/azalea-protocol/src/mc_buf/write.rs b/azalea-protocol/src/mc_buf/write.rs index e5437ae8..57ec3a48 100755 --- a/azalea-protocol/src/mc_buf/write.rs +++ b/azalea-protocol/src/mc_buf/write.rs @@ -1,5 +1,4 @@ use super::{UnsizedByteArray, MAX_STRING_LENGTH}; -use async_trait::async_trait; use azalea_chat::component::Component; use azalea_core::{ difficulty::Difficulty, game_type::GameType, resource_location::ResourceLocation, @@ -9,7 +8,6 @@ use byteorder::{BigEndian, WriteBytesExt}; use std::io::Write; use uuid::Uuid; -#[async_trait] pub trait Writable { fn write_list(&mut self, list: &[T], writer: F) -> Result<(), std::io::Error> where @@ -48,7 +46,6 @@ pub trait Writable { fn write_uuid(&mut self, uuid: &Uuid) -> Result<(), std::io::Error>; } -#[async_trait] impl Writable for Vec { fn write_list(&mut self, list: &[T], writer: F) -> Result<(), std::io::Error> where @@ -363,9 +360,8 @@ impl McBufWritable for Difficulty { } // Component -#[async_trait] impl McBufWritable for Component { - // async fn read_into(buf: &mut R) -> Result + // async fn read_into(buf: &mut impl Read) -> Result // where // R: AsyncRead + std::marker::Unpin + std::marker::Send, // { -- cgit v1.2.3