This would be nice purely for ergonomics, whether or not the elements are ultimately collected into a vec internally. Poking around the source however, it does look like the bulk load might be able to avoid such intermediate collection. Either way is a win.
// The current way
let elements = my_iter.collect::<Vec<_>>();
let tree = RTree::bulk_load(elements)
// When std::iter::FromIterator is implemented for RTree
let tree = my_iter.collect::<RTree>();
Bonus easy sub-trees:
let subtree = my_tree.into_iter().filter(x).collect::<RTree<_>>();
I understand the sub-trees can also be created by using drain_with_selection_function, but that requires setting up a SelectionFunction, possibly cloning the original tree, and discarding the drained items. I'm not actually sure which method would be most performant.
This would be nice purely for ergonomics, whether or not the elements are ultimately collected into a vec internally. Poking around the source however, it does look like the bulk load might be able to avoid such intermediate collection. Either way is a win.
Bonus easy sub-trees:
I understand the sub-trees can also be created by using
drain_with_selection_function, but that requires setting up aSelectionFunction, possibly cloning the original tree, and discarding the drained items. I'm not actually sure which method would be most performant.