[][src]Struct nobility::bin_encode::NbtWriter

pub struct NbtWriter { /* fields omitted */ }

This object owns the buffer that the NBT is being written into. It represents one document.

Example

use nobility::bin_encode::NbtWriter;

let mut writer = NbtWriter::new();
let mut root = writer.root("hello world");
// ... fill in contents ...
// finish() call is required.
root.finish();

let result: Vec<u8> = writer.finish();

Implementations

impl NbtWriter[src]

pub fn new() -> NbtWriter[src]

Creates a new empty writer.

pub fn root<'a>(&'a mut self, name: &str) -> CompoundWriter<'a>[src]

Creates the root tag with the given name and returns a builder for it.

pub fn finish(self) -> Vec<u8>[src]

Finalizes the NBT document and returns the buffer for use.

Panics

This method panics if root() was never called, as this would result in an invalid document.

Trait Implementations

impl Debug for NbtWriter[src]

impl Default for NbtWriter[src]

Auto Trait Implementations

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.