Closed joshchngs closed 11 months ago
Thanks for the PR, this is technically a breaking change if someone had manually implemented EnumIter, but I generally don't maintain back compat in those scenarios so this feels like a good change to me. Makes it easier to use the associated type :)
Thanks!
The concrete Iterator type for all implementations of IntoEnumIterator is guaranteed to implement these traits, because the only implementor is the
#[derive(EnumIter)]
macro, which emits an impl for each for the generated {EnumType}Iter struct.However, when using IntoEnumIterator as a generic constraint, the concrete type is not known, so the impl of these traits cannot be inferred by the type checker with out additional help.
Here are some examples, using Itertools::cartesian_product() as the motivator, because it requires
Iterator + Clone
:Tested against Rust 1.52.1, 1.72.1, & 1.74.0