pub fn i64_array<T, S>(array: T, serializer: S) -> Result<S::Ok, S::Error>Expand description
This function provides serde serialization support for NBT type LongArray.
It should be used in conjunction with serde’s field annotation serialize_with.
In the following example int_data will be serialized as a LongArray
instead of a List of Ints:
extern crate serde;
use nbt::to_writer;
use serde::Serialize;
let mut serialized = Vec::new();
// Declare your struct
#[derive(Serialize)]
struct Enderman {
#[serde(serialize_with="nbt::i64_array")]
long_data: Vec<i64>,
}
// Serialize to NBT!
to_writer(
&mut serialized,
&Enderman {
long_data: vec![0x1848ccd2157df10e, 0x64c5efff28280e9a],
},
None
).unwrap();
print!("Serialized: {:?}", serialized);