Documentation: docs.rs
Fast deserializer and parser for Minecraft: Java Edition's NBT format.
Includes
Read trait.The derserializer allows you to avoid allocations where possible. Strings can be
deserialized to &'a str where 'a is the lifetime of the data being
deserialized. The borrow module contains more types for avoiding allocations.
See the documentation for more information.
toml
[dependencies]
fastnbt = "1"
fastnbt follows Semver, so any version 1 code you write should remain valid.
Some things that this project does not count as a breaking change are:
serde::Serialise to enable spitting out to other data formats, but may
change structure in future.Changes that make fastnbt incompatible with WebAssembly are considered
breaking changes.
There are other crates for NBT out there, this tries to give an honest
comparison to them. The Hemtite nbt crate was the only other crate I found with serde deserialization.
| Feature | fastnbt | Hematite nbt | note |
| ------- | --------- | -------------- | ---- |
| Benchmark world render time (relative)* | 1.00 | 1.37 | fastnbt is ~37% faster. See note. |
| Deserialization | yes | yes | |
| Serialization | no | yes | |
| Value-like type | yes | yes | fastnbt is careful to preserve exact types. |
| Long Array (MC 1.12+) | yes | yes | |
| Minecraft specialized unicode | yes | yes | |
| Deserialize from reader | no | yes | |
| WASM compatible | yes | unknown | |
* This is rendering the overworld of Etho's Lets Play Episode 550. Exact relative
figures are 1000±13 for fastnbt and 1370±7 for hematite-nbt. This used the
anvil tiles executable, swapping out the deserializer only, so performance
tweaks in rendering chunks are not counted.