Skip to content

Enable unwrap_newtypes extension during serialization#333

Merged
torkleyy merged 2 commits into
ron-rs:masterfrom
juntyr:unwrap-newtypes-ser
Nov 15, 2021
Merged

Enable unwrap_newtypes extension during serialization#333
torkleyy merged 2 commits into
ron-rs:masterfrom
juntyr:unwrap-newtypes-ser

Conversation

@juntyr

@juntyr juntyr commented Nov 2, 2021

Copy link
Copy Markdown
Member

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

juntyr commented Nov 2, 2021

Copy link
Copy Markdown
Member Author

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

@juntyr

juntyr commented Nov 15, 2021

Copy link
Copy Markdown
Member Author

@torkleyy Does this PR look good to you?

@torkleyy torkleyy left a comment

Copy link
Copy Markdown
Member

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