| Crates.io | ussr-nbt |
| lib.rs | ussr-nbt |
| version | 0.2.1 |
| created_at | 2024-08-10 16:44:32.427608+00 |
| updated_at | 2024-08-12 17:39:06.174756+00 |
| description | A very fast and versatile NBT library for Minecraft: Java Edition. |
| homepage | |
| repository | https://github.com/TheAIguy-dev/ussr |
| max_upload_size | |
| id | 1332526 |
| size | 322,811 |
A very fast and versatile NBT library for Minecraft: Java Edition.
Some features of this library:
borrow module for avoiding most allocations and all copying.Nbt) and partial (Compound, Tag, List) NBT values.TAG_Long_Array introduced in Minecraft 1.12.use std::net::TcpStream;
use ussr_nbt::owned::*;
fn main() {
let mut conn: TcpStream = TcpStream::connect("127.0.0.1:25565").unwrap();
let nbt: Nbt = Nbt::read(&mut conn).unwrap();
println!("{nbt:#?}");
}
For more examples see the examples directory.
i32::MAX] elements for lists/arrays and up to [u16::MAX] bytes for strings. This is due to the fact that the NBT specification uses [i32] for lengths of lists/arrays and [u16] for lengths of strings.nbt! macro for constructing NBT values.serde support.Debug/Display.RawVec and RawSlice, although converting in bulk is more efficient.Deserialization:
simdnbt::borrowussr-nbt::borrowsimdnbt::ownedussr-nbt::ownedshen-nbt5azalea-nbtgraphite_binary
Serialization:
simdnbt::ownedazalea-nbtussr-nbt::borrowussr-nbt::owned*simdnbt::borrow*graphite_binaryshen-nbt5*Note: numbers 4 and 5 are very close.

Plots are generated using criterion.
For swapping endianness in bulk this library uses SIMD instructions. By default, it will detect CPU features and use the fastest available instruction set. However, if you disable the rt-cpu-feat feature, it will always use the fallback implementation, which is actually the most performant implementation if compiled with -C target-cpu=native. Note that this flag will make the resulting binary not be able to run on CPUs other than the one it was compiled on.