Module serde_nbt::byte_array
source · [−]Expand description
Provides (de)serialization support for the NBT type “byte array”.
This module is intended to be the target of serde’s #[serde(with = "module")]
field attribute.
The target field must serialize and deserialize as a seq.
Examples
use serde::{Deserialize, Serialize};
use serde_nbt::binary::to_writer;
#[derive(Serialize, Deserialize)]
struct MyStruct {
#[serde(with = "serde_nbt::int_array")]
array: Vec<i32>,
}
let s = MyStruct {
array: vec![1, 2, 3],
};
let mut buf = Vec::new();
to_writer(&mut buf, &s).unwrap();