Expand description
fastsnbt aims for fast deserializing and serializing of
sNBT data from Minecraft: Java Edition.
This is the human-readable equivalent of NBT data. (see
fastnbt).
- For documentation of serde (de)serialization, see
serandde. - See
fastnbtfor most NBT related things.
§Example
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct SimpleStruct {
num: i64,
s: String,
}
let data = SimpleStruct {
num: 31300,
s: "Hello world!".into(),
};
let ser = fastsnbt::to_string(&data).unwrap();
assert_eq!("{\"num\":31300l,\"s\":\"Hello world!\"}", ser);
let input = "{num:31300L,s:\"Hello world!\"}";
let de: SimpleStruct = fastsnbt::from_str(input).unwrap();
assert_eq!(data, de);Modules§
- de
- This module contains a serde deserializer. It can do most of the things you would expect of a typical serde deserializer, such as deserializing into:
- error
- Contains the
ErrorandResulttype used by the deserializer. - ser
- This module contains a serde serializer for sNBT data.
This should be able to serialize most structures to sNBT.
Use
to_vecorto_string.