8 releases (breaking)

0.8.0 Sep 14, 2023
0.7.0 May 17, 2023
0.6.0 Feb 10, 2023
0.5.0 Dec 9, 2022
0.1.0 Aug 30, 2022

#358 in Compression

Download history 48/week @ 2023-11-04 67/week @ 2023-11-11 56/week @ 2023-11-18 77/week @ 2023-11-25 65/week @ 2023-12-02 48/week @ 2023-12-09 56/week @ 2023-12-16 59/week @ 2023-12-23 55/week @ 2023-12-30 45/week @ 2024-01-06 42/week @ 2024-01-13 43/week @ 2024-01-20 56/week @ 2024-01-27 24/week @ 2024-02-03 71/week @ 2024-02-10 168/week @ 2024-02-17

330 downloads per month

MIT license

65KB
1.5K SLoC

Azalea NBT

A fast NBT serializer and deserializer.

  • Gzip and Zlib compression
  • All data is owned for ease-of-use
  • Serde support with the serde feature.

Examples

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()),
        )]))
    )]))
);

Benchmarks

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'.

Dependencies

~1.5–2.2MB
~44K SLoC