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

feat: use strum to better manage string enums #25

Merged
merged 1 commit into from
Apr 29, 2024
Merged

feat: use strum to better manage string enums #25

merged 1 commit into from
Apr 29, 2024

Conversation

bc-m
Copy link
Owner

@bc-m bc-m commented Apr 29, 2024

Thanks to @jwillinghalpern for this idea in jwillinghalpern@3e919c7.

@bc-m bc-m merged commit c28a4ac into main Apr 29, 2024
1 check passed
@jwillinghalpern
Copy link

jwillinghalpern commented Apr 29, 2024

Hey, it probably doesn't really matter either way, but I also played with an even less noisy way using the FromRepr feature of strum to make the code even less noisy. But it has the downside of not being able to (directly) associate multiple strings directly with the Unknown variant, if that's required. The from id function can still handle unknown ids and route them to Unkown though.

jwillinghalpern@f9e263c

@bc-m
Copy link
Owner Author

bc-m commented Apr 29, 2024

Hey, it probably doesn't really matter either way, but I also played with an even less noisy way using the FromRepr feature of strum to make the code even less noisy. But it has the downside of not being able to (directly) associate multiple strings directly with the Unknown variant, if that's required. The from id function can still handle unknown ids and route them to Unkown though.

jwillinghalpern@f9e263c

I like, thats a way less noisy! Actually, the script step ids for unknown script steps don't matter at all. I just used the enum to keep track of them because it was easy. I would also be fine with keeping the known step ids of unknown steps in a separate list and handle them in "from id" as you suggested.

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.

None yet

2 participants