Enum simdnbt::owned::Nbt

source ·
pub enum Nbt {
    Some(BaseNbt),
    None,
}

Variants§

§

Some(BaseNbt)

§

None

Implementations§

source§

impl Nbt

source

pub fn new(name: Mutf8String, tag: NbtCompound) -> Self

source

pub fn read(data: &mut Cursor<&[u8]>) -> Result<Nbt, Error>

Reads NBT from the given data. Returns Ok(None) if there is no data.

source

pub fn read_unnamed(data: &mut Cursor<&[u8]>) -> Result<Nbt, Error>

source

pub fn write(&self, data: &mut Vec<u8>)

source

pub fn write_unnamed(&self, data: &mut Vec<u8>)

source

pub fn unwrap(self) -> BaseNbt

source

pub fn unwrap_or<'a>(&'a self, default: &'a BaseNbt) -> &'a BaseNbt

source

pub fn is_some(&self) -> bool

source

pub fn is_none(&self) -> bool

source

pub fn iter(&self) -> impl Iterator<Item = (&Mutf8Str, &NbtTag)>

Methods from Deref<Target = BaseNbt>§

source

pub fn name(&self) -> &Mutf8Str

Get the name of the NBT compound. This is often an empty string.

source

pub fn write(&self, data: &mut Vec<u8>)

Writes the NBT to the given buffer.

source

pub fn write_unnamed(&self, data: &mut Vec<u8>)

Methods from Deref<Target = NbtCompound>§

source

pub fn write(&self, data: &mut Vec<u8>)

source

pub fn get(&self, name: &str) -> Option<&NbtTag>

source

pub fn contains(&self, name: &str) -> bool

Returns whether there is a tag with the given name.

source

pub fn byte(&self, name: &str) -> Option<i8>

source

pub fn short(&self, name: &str) -> Option<i16>

source

pub fn int(&self, name: &str) -> Option<i32>

source

pub fn long(&self, name: &str) -> Option<i64>

source

pub fn float(&self, name: &str) -> Option<f32>

source

pub fn double(&self, name: &str) -> Option<f64>

source

pub fn byte_array(&self, name: &str) -> Option<&[u8]>

source

pub fn string(&self, name: &str) -> Option<&Mutf8Str>

source

pub fn list(&self, name: &str) -> Option<&NbtList>

source

pub fn compound(&self, name: &str) -> Option<&NbtCompound>

source

pub fn int_array(&self, name: &str) -> Option<&[i32]>

source

pub fn long_array(&self, name: &str) -> Option<&[i64]>

source

pub fn iter(&self) -> impl Iterator<Item = (&Mutf8Str, &NbtTag)>

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn keys(&self) -> impl Iterator<Item = &Mutf8Str>

source

pub fn values(&self) -> impl Iterator<Item = &NbtTag>

Trait Implementations§

source§

impl Clone for Nbt

source§

fn clone(&self) -> Nbt

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Nbt

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Nbt

source§

fn default() -> Nbt

Returns the “default value” for a type. Read more
source§

impl Deref for Nbt

§

type Target = BaseNbt

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl From<Nbt> for NbtTag

source§

fn from(value: Nbt) -> Self

Converts to this type from the input type.
source§

impl IntoIterator for Nbt

§

type Item = (Mutf8String, NbtTag)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<Nbt as IntoIterator>::Item>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq for Nbt

source§

fn eq(&self, other: &Nbt) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.