Hello everyone, I am trying to create a Macro that I can put on Enum variants to add a generic marker trait to them. I intend to use it in combination with strum to build type-safe string keys.
The goal:
pub enum FieldDataKey {
#[data_key(f64)] // <-- my macro
Enabled(u32),
#[data_key(String)] // <- my macro
Name(u32),
}
should generate
impl DataKey<f64> for FieldDataKey::Enabled {}
impl DataKey<String> for FieldDataKey::Name {}
How does this work? I am having a hard time finding any resources that explain how the macro system can be applied to enum variants.