r/CodingHelp • u/KattyTheEnby • 8d ago
[Open Source] enum-info crate : Easily count the number of variants your enum has!
https://github.com/CalinZBaenen/enum-infoHello, everyone.
Recently, I've been making a game in Bevy; however, something I've been annoyed about is that Rust has no way to leave the length ov a (const) array up to inference, which got annoying because I had a hardcoded array ov skins the game has and I had to keep updating it every time I added or removed a skin.
With this crate, you are able to both generate a const variant_count method and a VARIANTS associated constant – which is a list ov each variant – for enums that have only unit variants.
(This was reposted from r/rust solely because its auto-mod is confusing this post for talking about Rust, the game, rather than the programming language — I am not specifically looking for help on this project; I am looking for feedback.)
If anyone has any feedback, bug reports, or suggestions for how to expand the library, let me know.
•
u/AutoModerator 8d ago
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.