-
Notifications
You must be signed in to change notification settings - Fork 9
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
Struct generation improvements #81
Conversation
Adds the possibility to make ZST structs and structs with unnamed fields. Backwards compability is insured by defaulting to `StructType::Named`, which causes identical behaviour to before.
Adds an enum generator, based on the struct generator.
Previously, structs could only be generated inside a new module. Sometimes, it is desirable to define a new struct in the same module as the struct that is being derived on. By dupicating the `generate_struct` function from `GenerateMod` to to `Generator`, this is easily achieved.
Would you mind adding examples that will also validate the generated code? An example can be found here |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## trunk #81 +/- ##
==========================================
- Coverage 48.42% 46.23% -2.20%
==========================================
Files 20 21 +1
Lines 2030 2124 +94
==========================================
- Hits 983 982 -1
- Misses 1047 1142 +95 ☔ View full report in Codecov by Sentry. |
I have added doc comment tests that I believe cover all of the added functionality. Please let me know if I missed anything! |
Add testcases for the struct and enum generators.
A Tuple struct is called a Tuple struct, not an unnamed field struct, so it makes more sense for the function to be called `make_tuple`, in line with `make_ZST`.
Thanks! |
This PR includes multiple improvements to virtue regarding the generation of Structs and Enums:
struct StructName;
).Points 2 and 3 have been previously raised in #23.
Point 1 is just something I ran into personally.