serde/test_suite/tests/regression/issue2371.rs
David Tolnay ce86f351d6
Make a directory dedicated to regression tests
I have had a good experience with this pattern in many of my other
libraries.
2023-03-08 19:02:42 -08:00

44 lines
773 B
Rust

use serde::Deserialize;
#[derive(Deserialize)]
pub struct Nested;
#[derive(Deserialize)]
pub enum ExternallyTagged {
Flatten {
#[serde(flatten)]
nested: Nested,
string: &'static str,
},
}
#[derive(Deserialize)]
#[serde(tag = "tag")]
pub enum InternallyTagged {
Flatten {
#[serde(flatten)]
nested: Nested,
string: &'static str,
},
}
#[derive(Deserialize)]
#[serde(tag = "tag", content = "content")]
pub enum AdjacentlyTagged {
Flatten {
#[serde(flatten)]
nested: Nested,
string: &'static str,
},
}
#[derive(Deserialize)]
#[serde(untagged)]
pub enum UntaggedWorkaround {
Flatten {
#[serde(flatten)]
nested: Nested,
string: &'static str,
},
}