forked from serde-rs/serde
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently panics in derive
- Loading branch information
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use serde_derive::Deserialize; | ||
|
||
#[derive(Deserialize)] | ||
pub struct Nested; | ||
|
||
#[derive(Deserialize)] | ||
pub enum ExternallyTagged1 { | ||
Tuple(f64, String), | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
pub enum ExternallyTagged2 { | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
Tuple(f64, String), | ||
} | ||
|
||
// Internally tagged enums cannot contain tuple variants so not tested here | ||
|
||
#[derive(Deserialize)] | ||
#[serde(tag = "tag", content = "content")] | ||
pub enum AdjacentlyTagged1 { | ||
Tuple(f64, String), | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
#[serde(tag = "tag", content = "content")] | ||
pub enum AdjacentlyTagged2 { | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
Tuple(f64, String), | ||
} | ||
|
||
#[derive(Deserialize)] | ||
#[serde(untagged)] | ||
pub enum Untagged1 { | ||
Tuple(f64, String), | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
#[serde(untagged)] | ||
pub enum Untagged2 { | ||
Flatten { | ||
#[serde(flatten)] | ||
nested: Nested, | ||
}, | ||
Tuple(f64, String), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters