I have a patch with a unit test demonstrating this issue (the test internal_variant_bool fails at deserialization): aramperes@0056f45
thread 'internal_variant_bool' panicked at 'NBT deserialization.: Serde("invalid type: integer `1`, expected a boolean")', src/libcore/result.rs:999:5
Context: Internally-tagged enum representation is a serde feature to define the struct used based on a field inside of said struct. In the patch, I am serializing a deserializing the following "variants" (represented as JSON here):
// internal_variant_string
{
"data": {
"variant": "String",
"data": "test"
}
}
// internal_variant_bool
{
"data": {
"variant": "Bool",
"data": true
}
}
There seems to be an incompatibility between this serde feature and hematite_nbt's bool deserialization mechanism. The error message shows that it is happening at the serde-level, which makes me think the deserialize_bool in nbt::de is not executed in this particular test case.
An easy work-around is to use u8 instead of bool for the BoolVariant struct.
I have a patch with a unit test demonstrating this issue (the test
internal_variant_boolfails at deserialization): aramperes@0056f45Context: Internally-tagged enum representation is a serde feature to define the struct used based on a field inside of said struct. In the patch, I am serializing a deserializing the following "variants" (represented as JSON here):
There seems to be an incompatibility between this serde feature and hematite_nbt's
booldeserialization mechanism. The error message shows that it is happening at the serde-level, which makes me think thedeserialize_boolinnbt::deis not executed in this particular test case.An easy work-around is to use
u8instead ofboolfor theBoolVariantstruct.