pub enum Nbt {
Some(BaseNbt),
None,
}
Variants§
Implementations§
source§impl Nbt
impl Nbt
pub fn new(name: Mutf8String, tag: NbtCompound) -> Self
sourcepub fn read(data: &mut Cursor<&[u8]>) -> Result<Nbt, Error>
pub fn read(data: &mut Cursor<&[u8]>) -> Result<Nbt, Error>
Reads NBT from the given data. Returns Ok(None)
if there is no data.
pub fn read_unnamed(data: &mut Cursor<&[u8]>) -> Result<Nbt, Error>
pub fn write(&self, data: &mut Vec<u8>)
pub fn write_unnamed(&self, data: &mut Vec<u8>)
pub fn unwrap(self) -> BaseNbt
pub fn unwrap_or<'a>(&'a self, default: &'a BaseNbt) -> &'a BaseNbt
pub fn is_some(&self) -> bool
pub fn is_none(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&Mutf8Str, &NbtTag)>
Methods from Deref<Target = BaseNbt>§
sourcepub fn name(&self) -> &Mutf8Str
pub fn name(&self) -> &Mutf8Str
Get the name of the NBT compound. This is often an empty string.
pub fn write_unnamed(&self, data: &mut Vec<u8>)
Methods from Deref<Target = NbtCompound>§
pub fn write(&self, data: &mut Vec<u8>)
pub fn get(&self, name: &str) -> Option<&NbtTag>
pub fn byte(&self, name: &str) -> Option<i8>
pub fn short(&self, name: &str) -> Option<i16>
pub fn int(&self, name: &str) -> Option<i32>
pub fn long(&self, name: &str) -> Option<i64>
pub fn float(&self, name: &str) -> Option<f32>
pub fn double(&self, name: &str) -> Option<f64>
pub fn byte_array(&self, name: &str) -> Option<&[u8]>
pub fn string(&self, name: &str) -> Option<&Mutf8Str>
pub fn list(&self, name: &str) -> Option<&NbtList>
pub fn compound(&self, name: &str) -> Option<&NbtCompound>
pub fn int_array(&self, name: &str) -> Option<&[i32]>
pub fn long_array(&self, name: &str) -> Option<&[i64]>
pub fn iter(&self) -> impl Iterator<Item = (&Mutf8Str, &NbtTag)>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn keys(&self) -> impl Iterator<Item = &Mutf8Str>
pub fn values(&self) -> impl Iterator<Item = &NbtTag>
Trait Implementations§
source§impl IntoIterator for Nbt
impl IntoIterator for Nbt
impl StructuralPartialEq for Nbt
Auto Trait Implementations§
impl Freeze for Nbt
impl RefUnwindSafe for Nbt
impl Send for Nbt
impl Sync for Nbt
impl Unpin for Nbt
impl UnwindSafe for Nbt
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more