Rusty-Quartz / quartz_nbt

Provides support for encoding and decoding Minecraft's NBT format. This crate supports both zlib and gz compression, and also provides tools for converting NBT data to stringified NBT (SNBT) and vice versa.
https://crates.io/crates/quartz_nbt
MIT License
25 stars 10 forks source link

Add snbt::parse_and_size #2

Closed Iaiao closed 2 years ago

Iaiao commented 2 years ago

parse_and_size returns the parsing result and a number of characters consumed. It can be useful when trying to find a leftover of a string (characters after ending })

Cassy343 commented 2 years ago

This seems like a good addition. I'm not totally sure if the name parse_and_size is the most idiomatic, but admittedly I can't think of anything better off the top of my head. One change I would like to see is switching the order of the tuple to be (NbtCompound, usize), since that's kind of implied by the function name: you get the thing you parsed first and then the size.

Iaiao commented 2 years ago

I'm not sure about the name too, but I couldn't find anything better