-
-
Notifications
You must be signed in to change notification settings - Fork 18
Complex Serialisation #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Serialisation is now fully functional, I will continue working on deserialisation, but this will be harder since i need to work with visitors. |
I also introduced the |
@dtolnay I hope its okay if I ping you here, I would really appreciate some input from your side. |
@@ -79,3 +79,32 @@ mod implicit_discriminant { | |||
assert_eq!(p, ImplicitDiscriminant::Two); | |||
} | |||
} | |||
|
|||
mod externally_tagged_complex_enum { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here an example of the current capabillities
Also, i know the code is a complete mess rn, but there are a lot of cases to cover, while beeing heavily codependent, but I will look into modularizing this suff once all represenations are covered. |
I decided to implement this in the main serde derive macro, since there are a lot of edge cases. With this full support should be garanteed. serde-rs/serde#2354 |
This is a first draft on complex type serialisation #6. The code is in heavy development and a complete mess.
To be as maintainable as possible the macro creates internal structs and uses the serde::Serialize macro for serialisation, where possible.
Implementation State
Serialisation:
{"42": { ... }}
){"tag": 42, ... }
){"tag": 42, "content": {...}}
)Deserialisation:
{"42": { ... }}
){"tag": 42, ... }
){"tag": 42, "content": {...}}
)Changes in Behavior of the Previous Macro
I have not found any
Internal Changes of generated Code
expression
of the variant instead of casting, since this is not possible with non unit variants