strum
strum copied to clipboard
Rename EnumIter => VariantIterator
Evaluating the naming scheme and value of all the macros used in strum. Some are more or less redundant such as ToString
now that Display
exists.
This is a tracking issue to solicit feedback about the usefulness of EnumIter
and whether it should be kept and if so, what it's name should be.
Well, I'm trying to use it, per the example, and it's not found. Was it taken out already? Is there a replacement?
use strum::IntoEnumIterator;
use strum::EnumIter;
| ^^^^^^^^^^^^^^^ no `EnumIter` in the root
Cargo.toml:
[dependencies]
strum = "0.19"
strum_macros = "0.19"
I really need this to deal with some large machine-generated enums.
Hey John,
You can do either this:
[dependencies]
strum = { version = "0.19", features = ["derive"] }
or if you want to leave the Cargo.toml as is, you should update the imports to be this.
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
Thanks. Just figured that out. Suggest updating documentation.
This macro is the original reason I found out about strum
, and added it as a dependency. It's one of the most important features of the crate, IMO!
I think this is an important feature missing from the main rust library, and I'm glad you've done it. The naming seems correct.
FTR I'm a beginner in rust and I currently have a use for EnumIter
.
IMO the name should be the same as the trait it implements, this is common throughout the rust ecosystem so much so that CLion's rust plugin relies on this for derive macros in order to increase analysis speed.