New Enum Derive Type (Enum Return Groups) #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ok first off I made this for another project of mine that uses
strum
and wanted to play around with macros and avoid my other project. so I don't really plan on updating this anymore unless I run into issues with my other project. But anyways I figured you guys/girls might be interested in it so I wrote some documents and am creating this pull request.I apologize for any "bad" code but I truly only code as a boredom/hobby thing.
Here is a TLDR of what this does. more info can be found in the
lib.rs -> EnumGroups()
as a doc string and playing in the tests.TLDR:
Edit (fixed my terrible grammar):
This groups all of the variants by there arguments and generates a struct with variable for each grouped return type wrapped in a
Option<T>
. each variant auto implements a new.get_groups()
which returns the generated struct of types; which should populated with allNone
except for the one that applies to the variant its called from. that result should beSome(T)