diff options
| author | mat <git@matdoes.dev> | 2024-12-25 06:16:10 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-12-25 06:16:10 +0000 |
| commit | 04eaa5c3d01a8f3a599a3a1abf7205eed80df4a2 (patch) | |
| tree | e37b34e8bf03045778f383f4e324414e2047ca92 /azalea-protocol/src/write.rs | |
| parent | 0ee9ed50e30222784d094e20302cadc879f2b6db (diff) | |
| download | azalea-drasl-04eaa5c3d01a8f3a599a3a1abf7205eed80df4a2.tar.xz | |
remove dependency on bytes crate for azalea-protocol and fix memory leak
Diffstat (limited to 'azalea-protocol/src/write.rs')
| -rwxr-xr-x | azalea-protocol/src/write.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/azalea-protocol/src/write.rs b/azalea-protocol/src/write.rs index 512d08ad..f1ffd82e 100755 --- a/azalea-protocol/src/write.rs +++ b/azalea-protocol/src/write.rs @@ -31,7 +31,7 @@ where pub fn serialize_packet<P: ProtocolPacket + Debug>( packet: &P, -) -> Result<Vec<u8>, PacketEncodeError> { +) -> Result<Box<[u8]>, PacketEncodeError> { let mut buf = Vec::new(); packet.id().azalea_write_var(&mut buf)?; packet.write(&mut buf)?; @@ -42,7 +42,7 @@ pub fn serialize_packet<P: ProtocolPacket + Debug>( packet_string: format!("{packet:?}"), }); } - Ok(buf) + Ok(buf.into_boxed_slice()) } pub async fn write_raw_packet<W>( |
