Skip to content

Explore untagged enums#409

Closed
juntyr wants to merge 6 commits into
ron-rs:masterfrom
juntyr:253-untagged-enums
Closed

Explore untagged enums#409
juntyr wants to merge 6 commits into
ron-rs:masterfrom
juntyr:253-untagged-enums

Conversation

@juntyr

@juntyr juntyr commented Sep 18, 2022

Copy link
Copy Markdown
Member

Experimentation for #253 and #397

  • I've included my change in CHANGELOG.md

@codecov-commenter

codecov-commenter commented Sep 18, 2022

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 72.54335% with 190 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.32%. Comparing base (298f918) to head (afb960b).
⚠️ Report is 99 commits behind head on master.

Files with missing lines Patch % Lines
src/value/mod.rs 32.14% 152 Missing ⚠️
src/de/mod.rs 77.77% 22 Missing ⚠️
src/ser/value.rs 0.00% 14 Missing ⚠️
src/de/id.rs 80.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #409      +/-   ##
==========================================
- Coverage   79.81%   79.32%   -0.50%     
==========================================
  Files          54       55       +1     
  Lines        7080     7747     +667     
==========================================
+ Hits         5651     6145     +494     
- Misses       1429     1602     +173     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@juntyr

juntyr commented Sep 18, 2022

Copy link
Copy Markdown
Member Author

@torkleyy This is mostly an old experiment that I just rebased, but I wanted to see what would need to be done to make this feel right. Essentially, we could land this change 'as-is' to support all serde enum shenanigans. While this might be an ok first step, it would change how our Value type works and tie it even more to json. Hence, I'm now experimenting a bit with whether this change could be done in combination with a more rony Value that has variants for structs (and tuples). Here are my findings so far:

  • since serialising requires &'static str for all struct and field names, the Value would need to use those as well. Hence, any deserialising would require some string interning (e.g. using https://github.com/CAD97/simple-interner which supports &'static str from rust 1.63 onwards)
  • structs without a name in ron will bite us - we can either reject deserialising them or reject serialising them since serde doesn't have that concept
  • so far treating structs like enums in ron seems to work fine

I think in the end this will come down to whether we want the ron::Value to be essentially a clone of serde_json::Value (easy to implement but no roundtrips) or reflect ron more (more work). Any thoughts?

@juntyr

juntyr commented May 1, 2023

Copy link
Copy Markdown
Member Author

Superseded by #451

@juntyr juntyr closed this May 1, 2023
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.

3 participants