diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-11-19 22:07:38 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-19 22:07:38 -0600 |
| commit | 2c610826fc9f8e16897f52313faa8e0602d1dc3d (patch) | |
| tree | 5aad79ecab3b68511a10ebd7eba07af0bd8a5905 /azalea-buf/src/write.rs | |
| parent | 84e036ce3752ecf57904b0f5aff1f33d43e95a32 (diff) | |
| download | azalea-drasl-2c610826fc9f8e16897f52313faa8e0602d1dc3d.tar.xz | |
Replace azalea-nbt with simdnbt (#111)
* delete azalea-nbt and replace with simdnbt
* use simdnbt from crates.io
* remove serde dependency on azalea-registry
Diffstat (limited to 'azalea-buf/src/write.rs')
| -rwxr-xr-x | azalea-buf/src/write.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/azalea-buf/src/write.rs b/azalea-buf/src/write.rs index f48bf2ec..03d40d79 100755 --- a/azalea-buf/src/write.rs +++ b/azalea-buf/src/write.rs @@ -257,3 +257,27 @@ impl<T: McBufWritable, const N: usize> McBufWritable for [T; N] { Ok(()) } } + +impl McBufWritable for simdnbt::owned::NbtTag { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + self.write(&mut data); + data.write_into(buf) + } +} + +impl McBufWritable for simdnbt::owned::NbtCompound { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + simdnbt::owned::NbtTag::Compound(self.clone()).write(&mut data); + data.write_into(buf) + } +} + +impl McBufWritable for simdnbt::owned::Nbt { + fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> { + let mut data = Vec::new(); + self.write_unnamed(&mut data); + data.write_into(buf) + } +} |
