From dedcd0de8f017a00645b31cfdc1819a4e8da0850 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 1 May 2022 23:35:30 -0500 Subject: impl Write instead of Vec for consistency --- .../src/packets/game/clientbound_declare_commands_packet.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs') diff --git a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs index 703811c0..27f4fb16 100755 --- a/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_declare_commands_packet.rs @@ -1,7 +1,10 @@ use super::GamePacket; use crate::mc_buf::{McBufReadable, McBufWritable, Readable, Writable}; use azalea_core::resource_location::ResourceLocation; -use std::{hash::Hash, io::Read}; +use std::{ + hash::Hash, + io::{Read, Write}, +}; #[derive(Hash, Clone, Debug)] pub struct ClientboundDeclareCommandsPacket { @@ -14,7 +17,7 @@ impl ClientboundDeclareCommandsPacket { GamePacket::ClientboundDeclareCommandsPacket(self) } - pub fn write(&self, _buf: &mut Vec) -> Result<(), std::io::Error> { + pub fn write(&self, _buf: &mut impl Write) -> Result<(), std::io::Error> { panic!("ClientboundDeclareCommandsPacket::write not implemented") } @@ -60,7 +63,7 @@ impl McBufReadable for BrigadierNumber { } } impl McBufWritable for BrigadierNumber { - fn write_into(&self, buf: &mut Vec) -> Result<(), std::io::Error> { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { let mut flags = 0; if self.min.is_some() { flags |= 0x01; @@ -101,7 +104,7 @@ impl McBufReadable for BrigadierString { } } impl McBufWritable for BrigadierString { - fn write_into(&self, buf: &mut Vec) -> Result<(), std::io::Error> { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { buf.write_byte(*self as u8)?; Ok(()) } -- cgit v1.2.3