Over the past weekend, I've developed a compact macro crate called "kinded" which, in essence, generates a new copyable enum (referred to as a "kind" enum) based on a given enum. This new enum retains the same variants as the original, but without any associated data.
For instance, consider the following code snippet:
use kinded::Kinded;
#[derive(Kinded)]
enum Beverage {
Mate,
Coffee(String),
}
I'm not sure it's super idiomatic to emit other items from a derive macro, especially if there's not even a trait impl derived. A regular macro or attribute macro could be used instead. I'd love to hear others' opinions on this, as I have a similar situation in one of my projects.
Thanks for bringing this.
I know about enum-kinds, but I did not know that strum can solve this problem too.
Quesiton: does strum provide any kind of traits with an associated discriminant type?