Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Support parsing explicit discriminants on enums#45

Merged
VictorKoenders merged 2 commits intotrunkfrom
explicit_discriminants
Mar 30, 2023
Merged

Support parsing explicit discriminants on enums#45
VictorKoenders merged 2 commits intotrunkfrom
explicit_discriminants

Conversation

@VictorKoenders
Copy link
Contributor

This resulted in some breaking changes, but I think the code is better organized now:

  • Reworked StructBody to have optional field
  • Removed Fields::Unit
  • Removed Fields::Literal, moved this literal value to EnumVariant
  • Made EnumVariant::fields optional

@VictorKoenders VictorKoenders linked an issue Mar 30, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

❗ No coverage uploaded for pull request base (trunk@e0b29b0). Click here to learn what that means.
Patch coverage: 85.71% of modified lines in pull request are covered.

❗ Current head 97ed618 differs from pull request most recent head 1fbfefa. Consider uploading reports for the commit 1fbfefa to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##             trunk      #45   +/-   ##
========================================
  Coverage         ?   49.00%           
========================================
  Files            ?       19           
  Lines            ?     1900           
  Branches         ?        0           
========================================
  Hits             ?      931           
  Misses           ?      969           
  Partials         ?        0           
Impacted Files Coverage Δ
src/parse/body.rs 73.12% <85.55%> (ø)
src/parse/generics.rs 70.94% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Removed `Fields::Unit`
Removed `Fields::Literal`, moved this literal value to `EnumVariant`
Made `EnumVariant::fields` optional
@VictorKoenders VictorKoenders force-pushed the explicit_discriminants branch from 97ed618 to 1fbfefa Compare March 30, 2023 08:53
@VictorKoenders VictorKoenders merged commit cfb17c0 into trunk Mar 30, 2023
@VictorKoenders VictorKoenders deleted the explicit_discriminants branch March 30, 2023 08:57
mkj added a commit to mkj/virtue that referenced this pull request Mar 30, 2023
A Struct { } should have Some(Fields::Struct(vec![])) rather than None.

This partially reverts cfb17c0 (bincode-org#45)
mkj added a commit to mkj/virtue that referenced this pull request Apr 5, 2023
A Struct { } should have Some(Fields::Struct(vec![])) rather than None.

This partially reverts cfb17c0 (bincode-org#45)
VictorKoenders pushed a commit that referenced this pull request Apr 7, 2023
* Treat empty struct fields differently to a unit

A Struct { } should have Some(Fields::Struct(vec![])) rather than None.

This partially reverts cfb17c0 (#45)

* Add extra checks in test_enum_body_take()

New tests for empty struct members, and test Fields::names()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support parsing explicit discriminants on enums

1 participant