-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
It appears that the IterVariants derive will only produce a private fn iter() which makes it only useful in the module where the enum is defined. I'd like to see a way to override this:
pub mod foo {
#[derive(enum_utils::IterVariants)]
// well-behaved attributes are namespaced
// also so you only have to declare the `enum_utils` attribute in `#[proc_macro_derive]`
#[enum_utils(iter(visibility = "pub"))]
pub enum Foo {
Bar,
Baz
}
}
fn main() {
let variants = foo::Foo::iter();
}Additionally, it might be nice to override the generated method name:
#[derive(enum_utils::IterVariants)]
#[enum_utils(iter(name = "variants"))]
enum Foo {
Bar,
Baz
}
fn main() {
let variants = Foo::variants();
}akprasad and veta666
Metadata
Metadata
Assignees
Labels
No labels