Skip to content

Bulk Load via Iterator #174

@bugeats

Description

@bugeats

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions