orlp / slotmap

Slotmap data structure for Rust
zlib License
1.13k stars 70 forks source link

Non-mut iterators are not `Clone` if K and V are not `Clone` #62

Closed ennis closed 3 years ago

ennis commented 3 years ago

The iterators returned by iter() and values() cannot be cloned if the keys and values are not Clone themselves. I think this should not be necessary: for instance, std::slice::Iter is Clone regardless of the element type. To fix this, Iter, Keys, Values should implement Clone manually (#[derive(Clone)] adds extra Clone bounds on the type parameters: see https://github.com/rust-lang/rust/issues/26925)

orlp commented 3 years ago

Seems like a good idea, I will review your patch when I will make the next release of slotmap.