Trait nbt_lib::traits::NbtWrite

source ·
pub trait NbtWrite {
    // Required methods
    fn write_i8_array(writer: &mut Vec<u8>, data: &[i8]);
    fn write_i32_array(writer: &mut Vec<u8>, data: &[i32]);
    fn write_i64_array(writer: &mut Vec<u8>, data: &[i64]);
    fn write_nbt_string(writer: &mut Vec<u8>, data: &str);
    fn write_list(writer: &mut Vec<u8>, data: &[NbtValue]) -> NbtResult<()>;
    fn write_compound(
        writer: &mut Vec<u8>,
        name: Option<&String>,
        data: Vec<(&String, &NbtValue)>
    ) -> NbtResult<()>;
    fn write_to(value: &NbtValue, buff: &mut Vec<u8>) -> NbtResult<()>;
    fn write_to_with_name(
        name: &str,
        value: &NbtValue,
        buff: &mut Vec<u8>
    ) -> NbtResult<()>;
    fn write_text_component(
        writer: &mut Vec<u8>,
        value: &NbtValue
    ) -> NbtResult<()>;

    // Provided method
    fn to_bytes(value: &NbtValue) -> NbtResult<Vec<u8>> { ... }
}
Expand description

Trait for every type that has to be write NBT data

Required Methods§

source

fn write_i8_array(writer: &mut Vec<u8>, data: &[i8])

function to write a signed 8-bit integer array

source

fn write_i32_array(writer: &mut Vec<u8>, data: &[i32])

function to write a signed 32-bit integer array

source

fn write_i64_array(writer: &mut Vec<u8>, data: &[i64])

function to write a signed 64-bit integer array

source

fn write_nbt_string(writer: &mut Vec<u8>, data: &str)

function to write a string

source

fn write_list(writer: &mut Vec<u8>, data: &[NbtValue]) -> NbtResult<()>

function to write a list of nbt values

source

fn write_compound( writer: &mut Vec<u8>, name: Option<&String>, data: Vec<(&String, &NbtValue)> ) -> NbtResult<()>

function to write a list of named nbt values

source

fn write_to(value: &NbtValue, buff: &mut Vec<u8>) -> NbtResult<()>

function to write nbt data to an vector

source

fn write_to_with_name( name: &str, value: &NbtValue, buff: &mut Vec<u8> ) -> NbtResult<()>

function to write nbt data to an vector with an name

source

fn write_text_component(writer: &mut Vec<u8>, value: &NbtValue) -> NbtResult<()>

function to write a text component to an vector

Provided Methods§

source

fn to_bytes(value: &NbtValue) -> NbtResult<Vec<u8>>

function to convert nbt data into bytes

Object Safety§

This trait is not object safe.

Implementors§