Crates.io | craftflow-nbt |
lib.rs | craftflow-nbt |
version | |
source | src |
created_at | 2024-10-26 09:45:16.006237 |
updated_at | 2024-10-28 15:06:23.677865 |
description | A serde-based NBT (from Minecraft) binary format implementation |
homepage | |
repository | https://github.com/PonasKovas/craftflow/tree/master/craftflow-nbt |
max_upload_size | |
id | 1423688 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A serde-based implementation of the Minecraft NBT binary format.
Deserialize
derived by serde macros does some crazy stuff with types,
so if you have multiple variants with differrent "flavors" of the same base type (integers: byte, short, int, long, or lists: list, byte array, int array, long array)
serde will automatically convert it the value that is first defined in the enum. For example:
#[derive(serde::Deserialize)]
#[serde(untagged)]
enum Example {
First(u32),
Second(u64),
}
Using the code above, even if you encounter a value that is encoded as a Long
in NBT, serde will still always give you Example::First
,
except for when the number is big enough that it can't fit in a u32
.
This is very inconsistent and therefore if you need this functionality, consider implementing Deserialize
manually. See the implementation of DynNBT
for an example.Tag::End
byte. However, if inside a compound, will be skipped altogether.