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

Enable unwrap_newtypes extension during serialization #333

Merged
merged 2 commits into from
Nov 15, 2021

Conversation

juntyr
Copy link
Member

@juntyr juntyr commented Nov 2, 2021

This PR fixes #284 and implements newtype unwrapping during serialization. E.g.

#[derive(Serialize)]
struct MyFloat(f64);

now serializes to 4.2 instead of MyFloat(4.2) or (4.2). Enabling the extension also adds the extension enabling attribute to the top of the serialized RON.

  • I've included my change in CHANGELOG.md

@juntyr juntyr marked this pull request as ready for review November 2, 2021 18:51
@juntyr
Copy link
Member Author

juntyr commented Nov 2, 2021

@torkleyy This PR is quite minimal and just mirrors the deserialization implementation. A follow-up for unwrap_variant_newtypes is coming soon.

@juntyr
Copy link
Member Author

juntyr commented Nov 15, 2021

@torkleyy Does this PR look good to you?

Copy link
Contributor

@torkleyy torkleyy left a comment

Choose a reason for hiding this comment

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

Thanks!

@torkleyy torkleyy merged commit 2936ae4 into ron-rs:master Nov 15, 2021
@juntyr juntyr deleted the unwrap-newtypes-ser branch November 16, 2021 09:06
torkleyy added a commit to torkleyy/ron that referenced this pull request Jun 6, 2022
Enable `unwrap_newtypes` extension during serialization
@torkleyy torkleyy mentioned this pull request Jun 6, 2022
2 tasks
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.

Support UNWRAP_NEWTYPES in the serializer
2 participants