Skip to content
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

Add basic struct flattening support #16

Merged
merged 14 commits into from
Feb 11, 2022
Merged

Add basic struct flattening support #16

merged 14 commits into from
Feb 11, 2022

Conversation

mitsuhiko
Copy link
Owner

@mitsuhiko mitsuhiko commented Feb 10, 2022

This implements basic flattening for flattening (#9). It takes advantage of the recent changes to eliminate the old MapSink and SeqSink but it needs a new unvetted OwnedSlot abstraction to allow deserializing into an adjacent slot.

There is an unsafe transmute in there which only exists because the borrow checker does not really understand loops (rust-lang/rust#54663). I'm not sure if there is a way to get away without the transmute by finding some clever alternative ways to structure this code.

Remaining tasks:

  • basic serialize
  • basic deserialize
  • support combined usage of skip_serializing_if and flatten
  • figure out support for skip_serializing_optionals with flatten
  • tests

@mitsuhiko mitsuhiko changed the title Added experimental flattening support Add basic struct flattening support Feb 11, 2022
@mitsuhiko mitsuhiko merged commit 78a2e7a into main Feb 11, 2022
@mitsuhiko mitsuhiko deleted the feature/flatten branch February 11, 2022 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant