Function nbt::decode [−][src]
pub fn decode<T: DeserializeOwned>(tag: Blob) -> Result<T, NBTError>
Decode a NBT Blob into a Serde deserializable value.
Example
use nbt::{Tag, decode, Blob}; use serde::Deserialize; // Create Deserializable struct #[derive(Deserialize, PartialEq, Debug)] pub struct Example { foo: String } // Create a Blob let mut blob = Blob::new(); blob.insert("foo", "bar"); // Decode the data from blob let data: Example = decode(blob).unwrap(); assert_eq!(data, Example { foo: "bar".to_string() });