From 4d7bf6c50eda970ac4998f10f5e46006dffb6ca2 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 30 Apr 2022 01:43:00 -0500 Subject: significantly optimize reading Vec unfortunately, this introduces the requirement of using rust nightly --- azalea-protocol/src/mc_buf/read.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'azalea-protocol/src/mc_buf/read.rs') diff --git a/azalea-protocol/src/mc_buf/read.rs b/azalea-protocol/src/mc_buf/read.rs index 3d1aa0b3..a0e3e79f 100755 --- a/azalea-protocol/src/mc_buf/read.rs +++ b/azalea-protocol/src/mc_buf/read.rs @@ -272,7 +272,7 @@ impl McBufReadable for UnsizedByteArray { #[async_trait] impl McBufReadable for Vec { - async fn read_into(buf: &mut R) -> Result + default async fn read_into(buf: &mut R) -> Result where R: AsyncRead + std::marker::Unpin + std::marker::Send, { @@ -285,6 +285,16 @@ impl McBufReadable for Vec { } } +#[async_trait] +impl McBufReadable for Vec { + async fn read_into(buf: &mut R) -> Result + where + R: AsyncRead + std::marker::Unpin + std::marker::Send, + { + buf.read_byte_array().await + } +} + // string #[async_trait] impl McBufReadable for String { -- cgit v1.2.3