[][src]Struct nobility::bin_encode::TagWriter

pub struct TagWriter<'a> { /* fields omitted */ }

A builder for creating NBT tags. This is created using CompoundWriter::field.

Example

player.field("Name").string("Tiffany");
player.field("Health").int(20);

// There is no bool type in NBT, so bytes 0 and 1 are used instead.
player.field("EnjoysWritingDocumentation").byte(1);

player.field("FavoriteNumbers").float_list(&[3.14159, 7.0, 2147483647.0]);

Implementations

impl<'a> TagWriter<'a>[src]

pub fn byte(&mut self, value: i8)[src]

Create a TAG_Byte.

pub fn short(&mut self, value: i16)[src]

Create a TAG_Short.

pub fn int(&mut self, value: i32)[src]

Create a TAG_Int.

pub fn long(&mut self, value: i64)[src]

Create a TAG_Long.

pub fn float(&mut self, value: f32)[src]

Create a TAG_Float.

pub fn double(&mut self, value: f64)[src]

Create a TAG_Double.

pub fn byte_array(&mut self, data: &[u8])[src]

Create a TAG_Byte_Array.

pub fn string(&mut self, value: &str)[src]

Create a TAG_String.

pub fn raw_string(&mut self, data: &[u8])[src]

Similar to string(), but allows writing a string using raw binary data, in case the string you're writing contains invalid UTF-8.

pub fn compound(&'a mut self) -> CompoundWriter<'a>[src]

Create a TAG_Compound and returns a builder for its contents.

pub fn int_array(&mut self, data: &[i32])[src]

Create a TAG_Int_Array from the given slice.

pub fn long_array(&mut self, data: &[i64])[src]

Create a TAG_Long_Array from the given slice.

pub fn byte_list(&mut self, data: &[u8])[src]

Create a TAG_List of TAG_Byte.

pub fn short_list(&mut self, data: &[i16])[src]

Create a TAG_List of TAG_Short.

pub fn int_list(&mut self, data: &[i32])[src]

Create a TAG_List of TAG_Int.

pub fn long_list(&mut self, data: &[i64])[src]

Create a TAG_List of TAG_Long.

pub fn float_list(&mut self, data: &[f32])[src]

Create a TAG_List of TAG_Float.

pub fn double_list(&mut self, data: &[f64])[src]

Create a TAG_List of TAG_Double.

pub fn string_list(&mut self, data: &[&str])[src]

Create a TAG_List of TAG_String.

pub fn byte_array_list(&mut self, data: &[&[u8]])[src]

Create a TAG_List of TAG_Byte_Array.

pub fn compound_list(&'a mut self) -> CompoundListWriter<'a>[src]

Create a TAG_List of TAG_Compound.

pub fn uuid_bytes(&mut self, bytes: [u8; 16])[src]

Writes the bytes of a UUID in the Minecraft 1.16+ format (TAG_Int_Array of length 4).

pub fn uuid(&mut self, uuid: Uuid)[src]

Writes a uuid::Uuid in the Minecraft 1.16+ format (TAG_Int_Array of length 4). Requires the uuid feature.

pub fn is_finished(&self) -> bool[src]

Returns whether or not the tag has been written into.

Trait Implementations

impl<'a> Debug for TagWriter<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for TagWriter<'a>[src]

impl<'a> Send for TagWriter<'a>[src]

impl<'a> Sync for TagWriter<'a>[src]

impl<'a> Unpin for TagWriter<'a>[src]

impl<'a> !UnwindSafe for TagWriter<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.