Fix (de)serialization of new types where the internal type is skipped

This commit is contained in:
Jake Kiesel
2019-09-07 02:43:28 -06:00
parent 4cea81f93f
commit acc8640c1e
4 changed files with 57 additions and 4 deletions
+5
View File
@@ -44,6 +44,9 @@ struct Struct {
c: i32,
}
#[derive(PartialEq, Debug)]
struct NotSerializable;
#[derive(Serialize, PartialEq, Debug)]
enum Enum {
Unit,
@@ -64,6 +67,7 @@ enum Enum {
_a: i32,
_b: i32,
},
OneWithSkipped(#[serde(skip_serializing)] NotSerializable),
}
//////////////////////////////////////////////////////////////////////////
@@ -326,6 +330,7 @@ declare_tests! {
Token::I32(2),
Token::StructVariantEnd,
],
Enum::OneWithSkipped(NotSerializable) => &[Token::UnitVariant {name: "Enum", variant: "OneWithSkipped" }],
}
test_box {
Box::new(0i32) => &[Token::I32(0)],