mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 18:27:54 +00:00
Allow untagged unit variants to deserialize from Visitor::visit_none()
This commit is contained in:
@@ -137,6 +137,12 @@ enum EnumOther {
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum EnumUntaggedUnit {
|
||||
Unit,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug)]
|
||||
struct IgnoredAny;
|
||||
|
||||
@@ -788,6 +794,9 @@ declare_tests! {
|
||||
Token::Unit,
|
||||
],
|
||||
}
|
||||
test_enum_untagged_unit_from_none {
|
||||
UntaggedUnit::Unit => &[Token::None],
|
||||
}
|
||||
test_box {
|
||||
Box::new(0i32) => &[Token::I32(0)],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user