Trait quartz_nbt::NbtRepr[][src]

pub trait NbtRepr: Sized {
    fn read_nbt(&mut self, nbt: &NbtCompound) -> Result<(), NbtReprError>;
fn write_nbt(&self, nbt: &mut NbtCompound); fn to_nbt(&self) -> NbtCompound { ... } }
Expand description

Defines a type which has a full representation as a NbtCompound.

Full representation meaning that the type can be constructed from a NbtCompound, and fully serialized as one as well.

Required methods

Updates the data in this type based on the given compound. The intention is that data is copied, not moved, from the compound to update this type.

Writes all necessary data to the given compound to serialize this type.

Although not enforced, the data written should allow for the type to be restored via the read_nbt function.

Provided methods

Converts this type into an owned NbtCompound.

Currently this is just a wrapper around creating an empty compound, proceeding to call write_nbt on a mutable reference to that compound, then returning the compound.

Implementors