Rfcs: Enum::iter() for fieldless enums

Created on 15 Mar 2020  路  2Comments  路  Source: rust-lang/rfcs

There are various crates that allow for iterating over the constants in an enum, but such a core feature should be part of the standard library.

T-libs

Most helpful comment

Given that the linked crate has ~50k downloads over the course of a 1 1/2 years, I'm not inclined to believe that it's a "core feature". This should stay as an external crate.

Note: Rust has other "core features" as crates because it is so easy to link in a crate, and makes it easier to fix bugs. A bug in std is a bug forever (see std channels), but a bug in an external crate can be fixed.

All 2 comments

Given that the linked crate has ~50k downloads over the course of a 1 1/2 years, I'm not inclined to believe that it's a "core feature". This should stay as an external crate.

Note: Rust has other "core features" as crates because it is so easy to link in a crate, and makes it easier to fix bugs. A bug in std is a bug forever (see std channels), but a bug in an external crate can be fixed.

FWIW, there are other crates that do similar, such as strum_macros. If someone was truly interested in pushing this forward, I'd encourage them to do a broad review of the ecosystem to find how many potential crates exist and how many uses they have, plus whatever feedback from people who implemented the iterator "by hand" without a crate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mahkoh picture mahkoh  路  3Comments

Diggsey picture Diggsey  路  3Comments

mqudsi picture mqudsi  路  3Comments

3442853561 picture 3442853561  路  4Comments

rust-highfive picture rust-highfive  路  4Comments