Closed jakoschiko closed 11 months ago
Does https://docs.rs/rstar/0.10.0/rstar/struct.RTree.html#method.drain help for your use case?
Yes, I'm currently using this. But it would still be nice to have an implementation of IntoIterator<Item = T>
because this would improve the interoperability with other collection types.
Example:
let rtree: RTree<Rectangle> = todo!();
let vec: Vec<Rectangle> = rtree.into_iterator().collect();
Edit: Uh, my fault. This also works with RTree::drain
. I think I got confused after I got lifetime issues because the RTree
is not owned by the iterator. So this issue is probably only relevant for those rare cases in which it's necessary that the iterator owns the RTree
.
Currently
&RTree<T>
implementsIntoIterator<Item = &T>
and&mut RTree<T>
implementsIntoIterator<Item = &mut T>
.Would it be possible to also implement
IntoIterator<Item = T>
forRTree<T>
(that will be consumed)?I would be happy to help with a PR.