-
Notifications
You must be signed in to change notification settings - Fork 2
Closed as not planned
Labels
enhancementNew feature or requestNew feature or request
Description
It would be nice if exhaust provided a macro_rules macro, which would appear as follows:
#[derive(exhaust::Exhaust)]
enum Foo {
Bar,
Baz,
}
exhaust::exhaust!(Foo);
which would expand to an inherent impl:
impl Foo {
/// Appropriate doc comments here
pub fn exhaust() -> impl Iterator<Item = Self> {
<Self as exhaust::Exhaust>::exhaust()
}
}
I freetyped the above, so it might not be correct.
This pattern has some precendence -- notably, this is what downcast-rs does. It is awkward and effectively a bodge and it can be fully implemented by users, but:
- There are many times a user would want to implement this manually, so making that easier is a good idea
- Users can choose to not use it and implement it themselves, particularly if they want to rename the main method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request