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

Implements alias annotation and allow multiple deserialization renames. #1458

Merged
merged 3 commits into from Jan 19, 2019
Merged

Conversation

Lymia
Copy link
Contributor

@Lymia Lymia commented Jan 15, 2019

This implements #1456 and #595.

Some things in the implementation I'm not sure of:

  • This is only implement for fields and enum variants. While it'd make sense on containers for some formats like RON, it doesn't seem like the API actually allows for this.
  • The current implementation does not reflect the fact that it accepts aliases in the VARIANTS/FIELDS arrays passed to deserialize_struct, etc. I believe this is the right behavior because encoders like bincode care about the length of this list, and the flatten attribute causes field names that don't appear in this list anyway, but I can't be 100% sure.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is terrific. Very nicely done.

@dtolnay
Copy link
Member

dtolnay commented Jan 19, 2019

Released in serde_derive 1.0.85.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants