Enum fastnbt::Value[][src]

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

Value is a complete NBT value. It owns its data. Compounds and Lists are resursively deserialized. This type takes care to preserve all the information from the original NBT, with the exception of the name of the root compound (which is usually the empty string).

    let compound: HashMap<String, Value> = fastnbt::de::from_bytes(buf.as_slice())?;
    match compound["DataVersion"] {
        Value::Int(ver) => println!("Version: {}", ver),
        _ => {},
    }
    println!("{:#?}", compound);

Variants

Byte(i8)

Tuple Fields of Byte

0: i8
Short(i16)

Tuple Fields of Short

0: i16
Int(i32)

Tuple Fields of Int

0: i32
Long(i64)

Tuple Fields of Long

0: i64
Double(f64)

Tuple Fields of Double

0: f64
Float(f32)

Tuple Fields of Float

0: f32
String(String)

Tuple Fields of String

0: String
ByteArray(ByteArray)

Tuple Fields of ByteArray

0: ByteArray
IntArray(IntArray)

Tuple Fields of IntArray

0: IntArray
LongArray(LongArray)

Tuple Fields of LongArray

0: LongArray
List(Vec<Value>)

Tuple Fields of List

0: Vec<Value>
Compound(HashMap<String, Value>)

Tuple Fields of Compound

0: HashMap<String, Value>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.