mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 07:26:04 +00:00
add borrow::NbtCompound::keys
This commit is contained in:
parent
8e1e0af3ae
commit
86194a4680
2 changed files with 4 additions and 1 deletions
|
@ -12,7 +12,7 @@ cargo add simdnbt
|
|||
|
||||
### Deserializing
|
||||
|
||||
For deserializing, you'll likely want either [simdnbt::borrow::Nbt::read](https://docs.rs/simdnbt/latest/simdnbt/borrow/enum.Nbt.html#method.read) or [simdnbt::owned::Nbt::read](https://docs.rs/simdnbt/latest/simdnbt/owned/enum.Nbt.html#method.read).
|
||||
For deserializing, you'll likely want either [simdnbt::borrow::read](https://docs.rs/simdnbt/latest/simdnbt/borrow/fn.read.html) or [simdnbt::owned::read](https://docs.rs/simdnbt/latest/simdnbt/owned/fn.read.html).
|
||||
The difference is that the "borrow" variant requires you to keep a reference to the original buffer, but is significantly faster.
|
||||
|
||||
```rust,no_run
|
||||
|
|
|
@ -229,6 +229,9 @@ impl<'a> NbtCompound<'a> {
|
|||
pub fn is_empty(&self) -> bool {
|
||||
self.values.is_empty()
|
||||
}
|
||||
pub fn keys(&self) -> impl Iterator<Item = &Mutf8Str> {
|
||||
self.values.iter().map(|(k, _)| *k)
|
||||
}
|
||||
|
||||
pub fn to_owned(&self) -> crate::owned::NbtCompound {
|
||||
crate::owned::NbtCompound {
|
||||
|
|
Loading…
Add table
Reference in a new issue