mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 15:25:38 +00:00
Allow untagged unit variants to deserialize from Visitor::visit_none()
This commit is contained in:
parent
4eb580790d
commit
6e2c385fa5
@ -2510,6 +2510,13 @@ mod content {
|
|||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_none<E>(self) -> Result<(), E>
|
||||||
|
where
|
||||||
|
E: de::Error,
|
||||||
|
{
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,12 @@ enum EnumOther {
|
|||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Debug, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
enum EnumUntaggedUnit {
|
||||||
|
Unit,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
struct IgnoredAny;
|
struct IgnoredAny;
|
||||||
|
|
||||||
@ -788,6 +794,9 @@ declare_tests! {
|
|||||||
Token::Unit,
|
Token::Unit,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
test_enum_untagged_unit_from_none {
|
||||||
|
UntaggedUnit::Unit => &[Token::None],
|
||||||
|
}
|
||||||
test_box {
|
test_box {
|
||||||
Box::new(0i32) => &[Token::I32(0)],
|
Box::new(0i32) => &[Token::I32(0)],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user