Lymia / enumset

A library for compact bit sets containing enums.
Apache License 2.0
91 stars 35 forks source link

Implement std::iter::Sum for EnumSet? #22

Closed sdleffler closed 3 years ago

sdleffler commented 3 years ago

Would be nice for union-ing an iterator of EnumSets. :)

Could also implement std::iter::Product for intersections. Thoughts?

Lymia commented 3 years ago

Yeah, there's no real reason to not implement Sum. I'm not so sure about Product, just because it'd be a bit less intuitive what it does compared to Sum.

Lymia commented 3 years ago

Sum has been implemented long ago, and I'm not sure a Product impl along these lines is so appropriate in Rust. Rust libraries are rarely written in "axiomic" terms like that, e.g. "it fulfills product laws, so it's a product".