Function nbt::decode_tag[][src]

pub fn decode_tag<T: DeserializeOwned>(tag: Tag) -> Result<T, NBTError>

Decode a NBT Tag into a Serde deserializable value.

Example

use nbt::{Tag, decode_tag};

// Create a Byte List.
let tag = Tag::List(vec![Tag::Byte(127), Tag::Byte(42)]);

// Decode the tag into a vec.
let list: Vec<i8> = decode_tag(tag).unwrap();

assert_eq!(list, vec![127, 42]);