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

Allow map keys that are effectively strings #172

Merged
merged 2 commits into from
Dec 6, 2016
Merged

Allow map keys that are effectively strings #172

merged 2 commits into from
Dec 6, 2016

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Dec 5, 2016

@oli-obk
Copy link
Member

oli-obk commented Dec 5, 2016

If we are serializing unit variants, shouldn't we also serialize unit structs and units ( the latter as the empty string)? Does roundtripping work/ should it?

@dtolnay
Copy link
Member Author

dtolnay commented Dec 5, 2016

Unit structs and units are different because they serialize as null which is not a string. Unit variants serialize as "VariantName" which is a string. I don't think it is obvious to expect null in a map key to behave like an empty string (I know, even though we deserialize null to String as an empty string). Also who uses maps with unit keys?

Round tripping works, I added a test.

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