Crates.io | azalea-nbt |
lib.rs | azalea-nbt |
version | 0.8.0 |
source | src |
created_at | 2022-08-30 02:40:17.845065 |
updated_at | 2023-09-14 23:44:47.834301 |
description | A fast NBT serializer and deserializer. |
homepage | |
repository | https://github.com/mat-1/azalea/tree/main/azalea-nbt |
max_upload_size | |
id | 654901 |
size | 51,550 |
A fast NBT serializer and deserializer.
serde
feature.use azalea_nbt::{Nbt, NbtCompound};
use std::io::Cursor;
let buf = include_bytes!("../tests/hello_world.nbt");
let tag = Nbt::read(&mut Cursor::new(&buf[..])).unwrap();
assert_eq!(
tag,
Nbt::Compound(NbtCompound::from_iter(vec![(
"hello world".into(),
Nbt::Compound(NbtCompound::from_iter(vec![(
"name".into(),
Nbt::String("Bananrama".into()),
)]))
)]))
);
At the time of writing, Azalea NBT is the fastest NBT decoder (approximately twice as fast as Graphite NBT, the second fastest) and on-par with the fastest NBT encoders (sometimes the fastest, depending on the data).
You can run the benchmarks to compare against other NBT libraries with cargo bench --bench compare
and the normal benchmarks with cargo bench --bench nbt
.
Note: For best performance, use RUSTFLAGS='-C target-cpu=native'
.