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.