14

I just learned the basics of macros and figured I'd give a shot trying to solve a problem I've had for a while. Theres just one derive trait in this crate, Variants, that when derived will generate a constant array that holds all of the enum's variants along with a method that exposes a static reference to the constant array.

Give it a look, leave some feedback, maybe even open up a PR. I hope you like what you see!

top 3 comments
sorted by: hot top controversial new old
[-] QueenMidna@lemmy.ca 9 points 1 week ago
[-] AshrafIbrahim03@programming.dev 7 points 1 week ago

I wanted to learn how to write a simple macro and how to publish a crate.

[-] QueenMidna@lemmy.ca 5 points 1 week ago

Fair enough!

this post was submitted on 29 May 2025
14 points (100.0% liked)

Rust

7001 readers
5 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS