rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Enum::iter() for fieldless enums

Open ghost opened this issue 5 years ago • 6 comments
trafficstars

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.

ghost avatar Mar 15 '20 00:03 ghost

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.

RustyYato avatar Mar 15 '20 00:03 RustyYato

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.

shepmaster avatar Mar 15 '20 00:03 shepmaster

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.

If the logic for not including this was that it had too few downloads, I think it's worth mentioning that enum-iterator now has 2M+ downloads. I end up using it in all of my projects of sufficient scale.

image

finnbear avatar Mar 15 '22 23:03 finnbear

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.

strongly disagree

githik999 avatar Jun 20 '22 12:06 githik999

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.

If the logic for not including this was that it had too few downloads, I think it's worth mentioning that enum-iterator now has 2M+ downloads. I end up using it in all of my projects of sufficient scale.

image

it is now 3,158,869 and still growing everyday

githik999 avatar Jun 20 '22 12:06 githik999

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.

If the logic for not including this was that it had too few downloads, I think it's worth mentioning that enum-iterator now has 2M+ downloads. I end up using it in all of my projects of sufficient scale. image

it is now 3,158,869 and still growing everyday

And strum_macros has 17.8 million. I would love to have this feature too.

truppelito avatar Jun 20 '22 13:06 truppelito