pub struct Tree<V, S, T, const CHILDREN: usize> { /* private fields */ }
Expand description

A generic “grid tree” which can be either a quadtree or an octree depending on the type parameters.

Implementations

The maximum number of children a branch node can have. 4 for a quadtree and 8 for an octree.

This constructor is only necessary if you need to use a custom shape S or vector V. Otherwise use the constructor for OctreeI32 or QuadtreeI32.

Safety

You must guarantee that S correctly linearizes V vectors so that they don’t go out of array bounds in a block. Refer to QuadtreeShapeI32 and OctreeShapeI32 for examples.

The number of Levels in this tree.

The Level where root nodes live.

Returns the unique root at self.root_level() that is an ancestor of descendant_key.

Iterate over all root keys.

Iterate over all root nodes.

Returns true iff this tree contains a node for ptr.

Returns true iff this tree contains a root node at coords.

Safety

The node for ptr must exist.

Safety

The node for ptr must exist.

Inserts value at the root node at key. Returns the old value.

Gets the root pointer or calls filler to insert a value first.

Inserts a child node of parent_ptr storing child_value. Returns the old child value if one exists.

Same as insert_child but child_offset is linearized into a ChildIndex based on the BranchShape.

This means any given coordinate in child_offset can only be 0 or 1!

Equivalent to calling fill_root and then fill_descendants of that root.

May return the RootNode for convenience.

pub fn child_entry(
    &mut self,
    parent_ptr: NodePtr,
    child_index: ChildIndex
) -> NodeEntry<'_, T, CHILDREN>

Panics
  • If parent_ptr is at level 0 and hence cannot have children.
  • If no node exists for parent_ptr.

Inserts data in descendant “slots” of ancestor_ptr using filler().

Any node N is skipped if filler returns VisitCommand::SkipDescendants for any ancestor of N.

Call filler on all nodes from the root ancestor to target_key.

Looks up the root pointer for key in the top-level hash map.

Starting from the ancestor root, searches for the corresponding descendant node at key.

A ChildRelation is returned because it contains some extra useful info that is conveniently accessible during the search.

Starting from the node at ancestor_ptr, searches for the corresponding descendant node at descendant_key.

Visits pointers for all non-empty children of the node at parent_ptr.

If parent_ptr does not exist or does not have any children, nothing happens.

Visits pointers and coordinates for all non-empty children of the node at parent_ptr with coordinates parent_coords.

If parent_ptr does not exist or does not have any children, nothing happens.

Visit ancestor_ptr and all descendants in depth-first order.

If visitor returns false, descendants of that node will not be visited.

Visit ancestor_ptr and all descendants in breadth-first order.

If visitor returns false, descendants of that node will not be visited.

Returns an array of pointers to the children of parent_ptr.

Returns None if parent_ptr is at level 0.

Drops the child node of relation and all descendants.

Moves the child node of relation (with coordinates) and all descendants into consumer.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.