diff options
| author | mat <github@matdoes.dev> | 2022-04-26 15:33:41 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-26 15:33:41 +0000 |
| commit | e5fcfa119309877ab515b921f8ada5f1b1ec4c30 (patch) | |
| tree | c5084a2f7840979feaf7483e7b598cbc888c509f /azalea-protocol/src/mc_buf/mod.rs | |
| parent | f9528a9f9a9e73b1d657af7c78d743067307d843 (diff) | |
| download | azalea-drasl-e5fcfa119309877ab515b921f8ada5f1b1ec4c30.tar.xz | |
default implementation for read and write Vec<T>
Diffstat (limited to 'azalea-protocol/src/mc_buf/mod.rs')
| -rwxr-xr-x | azalea-protocol/src/mc_buf/mod.rs | 11 |
1 files changed, 5 insertions, 6 deletions
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<u8> that isn't prefixed by a VarInt with the size. #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ByteArray(Vec<u8>); +pub struct UnsizedByteArray(Vec<u8>); -impl Deref for ByteArray { +impl Deref for UnsizedByteArray { type Target = Vec<u8>; fn deref(&self) -> &Self::Target { @@ -23,13 +23,12 @@ impl Deref for ByteArray { } } -impl From<Vec<u8>> for ByteArray { +impl From<Vec<u8>> for UnsizedByteArray { fn from(vec: Vec<u8>) -> Self { Self(vec) } } - #[cfg(test)] mod tests { use super::*; |
