Enum nbt::Value [] [src]

pub enum Value {
    Byte(i8),
    Short(i16),
    Int(i32),
    Long(i64),
    Float(f32),
    Double(f64),
    ByteArray(Vec<i8>),
    String(String),
    List(Vec<Value>),
    Compound(HashMap<String, Value>),
    IntArray(Vec<i32>),
}

Values which can be represented in the Named Binary Tag format.

Variants

Byte
Short
Int
Long
Float
Double
ByteArray
String
List
Compound
IntArray

Methods

impl Value

fn id(&self) -> u8

The type ID of this Value, which is a single byte in the range 0x01 to 0x0b.

fn len(&self) -> usize

The length of the payload of this Value, in bytes.

fn write_header(&self, dst: &mut Write, title: &str) -> Result<()>

Writes the header (that is, the value's type ID and optionally a title) of this Value to an io::Write destination.

fn write(&self, dst: &mut Write) -> Result<()>

Writes the payload of this Value to an io::Write destination.

fn read_header(src: &mut Read) -> Result<(u8, String)>

Reads any valid Value header (that is, a type ID and a title of arbitrary UTF-8 bytes) from an io::Read source.

fn from_reader(id: u8, src: &mut Read) -> Result<Value>

Reads the payload of an Value with a given type ID from an io::Read source.

Trait Implementations

impl Display for Value

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

impl From<i8> for Value

fn from(t: i8) -> Value

impl From<i16> for Value

fn from(t: i16) -> Value

impl From<i32> for Value

fn from(t: i32) -> Value

impl From<i64> for Value

fn from(t: i64) -> Value

impl From<f32> for Value

fn from(t: f32) -> Value

impl From<f64> for Value

fn from(t: f64) -> Value

impl<'a> From<&'a str> for Value

fn from(t: &'a str) -> Value

impl From<String> for Value

fn from(t: String) -> Value

impl From<Vec<i8>> for Value

fn from(t: Vec<i8>) -> Value

impl<'a> From<&'a [i8]> for Value

fn from(t: &'a [i8]) -> Value

impl From<Vec<i32>> for Value

fn from(t: Vec<i32>) -> Value

impl<'a> From<&'a [i32]> for Value

fn from(t: &'a [i32]) -> Value

Derived Implementations

impl PartialEq for Value

fn eq(&self, __arg_0: &Value) -> bool

fn ne(&self, __arg_0: &Value) -> bool

impl Debug for Value

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for Value

fn clone(&self) -> Value

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