Skip to content

Enable unwrap_variant_newtypes extension during serialization#336

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

Enable unwrap_variant_newtypes extension during serialization#336
torkleyy merged 2 commits into
ron-rs:masterfrom
juntyr:unwrap-variant-newtypes-ser

Conversation

@juntyr

@juntyr juntyr commented Nov 16, 2021

Copy link
Copy Markdown
Member

This PR is a follow-up to #333 and implements newtype variant unwrapping during serialization (i.e. the inverse of #319). E.g.

#[derive(Serialize)]
struct Inner { x: u32 }

#[derive(Serialize)]
enum MyEnum {
    Newtype(Inner),
    ...
}

now serializes to Newtype(x: 42) instead of Newtype(Inner(x: 4.2)) or Newtype((x: 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 16, 2021 09:28
@juntyr

juntyr commented Nov 16, 2021

Copy link
Copy Markdown
Member Author

@torkleyy As promised, here's my follow-up to #333 so that all implemented extensions now support both serialization and deserialization.

@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, LGTM! :shipit:

@torkleyy torkleyy merged commit c4a7834 into ron-rs:master Nov 17, 2021
@juntyr juntyr deleted the unwrap-variant-newtypes-ser branch November 17, 2021 13:51
@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.

2 participants