From e5fcfa119309877ab515b921f8ada5f1b1ec4c30 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 26 Apr 2022 15:33:41 +0000 Subject: default implementation for read and write Vec --- azalea-protocol/src/mc_buf/mod.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'azalea-protocol/src/mc_buf/mod.rs') diff --git a/azalea-protocol/src/mc_buf/mod.rs b/azalea-protocol/src/mc_buf/mod.rs index 3ba6ac3e..3ab6e761 100755 --- a/azalea-protocol/src/mc_buf/mod.rs +++ b/azalea-protocol/src/mc_buf/mod.rs @@ -4,18 +4,18 @@ mod read; mod write; pub use read::{McBufReadable, McBufVarintReadable, Readable}; -pub use write::{McBufVarintWritable, McBufWritable, Writable}; use std::ops::Deref; +pub use write::{McBufVarintWritable, McBufWritable, Writable}; // const DEFAULT_NBT_QUOTA: u32 = 2097152; const MAX_STRING_LENGTH: u16 = 32767; // const MAX_COMPONENT_STRING_LENGTH: u32 = 262144; - +/// A Vec that isn't prefixed by a VarInt with the size. #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ByteArray(Vec); +pub struct UnsizedByteArray(Vec); -impl Deref for ByteArray { +impl Deref for UnsizedByteArray { type Target = Vec; fn deref(&self) -> &Self::Target { @@ -23,13 +23,12 @@ impl Deref for ByteArray { } } -impl From> for ByteArray { +impl From> for UnsizedByteArray { fn from(vec: Vec) -> Self { Self(vec) } } - #[cfg(test)] mod tests { use super::*; -- cgit v1.2.3