Add a way to iterate over all values in any enum

I believe it could be good to add a way to iterate over all values of any enum, I fell there are a lot of use cases for it

The strum crate provides this with #[derive(EnumIter)].

1 Like

Do you mean over C-like or an enum where all variants are non-tuple and non-struct? As an example, what are the values of

enum Hmm {


enum Weird {

I don't think I've ever wanted iteration for such an enum, but strum opts for [Big(0), Other]. I think a derive macro which recursively iterates enums could be derived from strum's macro, if that's what's desired.

I can't say I've wanted it either, but "all values of any enum" is quite a bit more than what strum is doing there. Of course, this isn't even in a pre-pre-pre-RFC form, so knowing whether such a phrasing is intentional or not realizing what such a phrasing would imply is difficult to discern without asking such questions (IMO).