| Crates.io | nobility |
| lib.rs | nobility |
| version | 0.2.0 |
| created_at | 2015-11-23 04:57:10.384808+00 |
| updated_at | 2020-12-29 02:50:10.259218+00 |
| description | NBT decoder |
| homepage | |
| repository | https://github.com/tiffany352/nobility |
| max_upload_size | |
| id | 3479 |
| size | 66,710 |
Nobility is a Rust crate for encoding and decoding NBT, which is a format used by Minecraft: Java Edition.
Features:
unsafe.This library is based on the spec at https://wiki.vg/NBT#Specification.
Missing features:
let mut file = File::open("hello_world.nbt")?;
let mut data = vec![];
file.read_to_end(&mut data)?;
let cursor = std::io::Cursor::new(data);
// Load the document. This step either copies the data (plaintext)
// or decompresses it (gzip).
let doc = Document::load(cursor)?;
// Parses the document. This returns the root tag's name, and the
// root tag (always a Compound tag). Both of these are borrowing the
// data inside the Document.
let (name, root) = doc.parse()?;
println!("name: {}", name.decode()?);
println!("{:#?}", root);
let mut writer = NbtWriter::new();
let mut root = writer.root("hello world");
root.field("name").string("Bananrama");
// finish() call is required.
root.finish();
let result: Vec<u8> = writer.finish();