diff options
Diffstat (limited to 'azalea-nbt')
| -rwxr-xr-x | azalea-nbt/Cargo.toml | 3 | ||||
| -rwxr-xr-x | azalea-nbt/README.md | 2 | ||||
| -rwxr-xr-x | azalea-nbt/src/encode.rs | 4 | ||||
| -rwxr-xr-x | azalea-nbt/src/tag.rs | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/azalea-nbt/Cargo.toml b/azalea-nbt/Cargo.toml index 11cad33d..1ff52cdd 100755 --- a/azalea-nbt/Cargo.toml +++ b/azalea-nbt/Cargo.toml @@ -9,13 +9,14 @@ repository = "https://github.com/mat-1/azalea/tree/main/azalea-nbt" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ahash = "^0.8.0" +ahash = { version = "^0.8.0", features = ["serde"]} azalea-buf = {path = "../azalea-buf", version = "^0.4.0" } byteorder = "^1.4.3" flate2 = "^1.0.23" log = "0.4.17" num-derive = "^0.3.3" num-traits = "^0.2.14" +serde = {version = "^1.0.148", features = ["derive"]} [dev-dependencies] criterion = {version = "^0.3.5", features = ["html_reports"]} diff --git a/azalea-nbt/README.md b/azalea-nbt/README.md index 4d5cecc4..19498cf3 100755 --- a/azalea-nbt/README.md +++ b/azalea-nbt/README.md @@ -1,5 +1,3 @@ # Azalea NBT A fast NBT serializer and deserializer. - -TODO: serde support for fast registry_holder parsing in azalea-client diff --git a/azalea-nbt/src/encode.rs b/azalea-nbt/src/encode.rs index 49c31192..87464fd9 100755 --- a/azalea-nbt/src/encode.rs +++ b/azalea-nbt/src/encode.rs @@ -193,6 +193,10 @@ impl Tag { write_compound(writer, value, false)?; Ok(()) } + Tag::End => { + 0u8.write_into(writer)?; + Ok(()) + } _ => Err(Error::InvalidTag), } } diff --git a/azalea-nbt/src/tag.rs b/azalea-nbt/src/tag.rs index de57b0a2..2bebe156 100755 --- a/azalea-nbt/src/tag.rs +++ b/azalea-nbt/src/tag.rs @@ -1,6 +1,8 @@ use ahash::AHashMap; +use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] pub enum Tag { End, // 0 Byte(i8), // 1 |
