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

This commit is contained in:
Jake Kiesel committed 2019-09-07 03:20:43 -06:00
1 parent 4cea81f93f
commit acc8640c1e
4 files changed
+57 -4

No files matched your search

+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)],