[][src]Crate bonzai

Macros

get_elem_mut

Given some type of tree access which implements GetElemMut, for which mutable access is available, and some type of guard which borrows from that tree and implements IntoReadGuard, produce a mutable reference to the guarded element.

traverse_from

Given a TreeOperation and some type of guard which borrows from that tree and implements IntoReadGuard, produce a TreeWriteTraverser that starts at that node.

traverse_read_from

Given a Tree and some type of guard which borrows from that tree and implements IntoReadGuard, produce a TreeReadTraverser that starts at that node.

Structs

ChildId

An opaque type used for genericity over branch factor.

ChildNotFound

Error type for attempting to detach a child that doesn't exist.

ChildWriteGuard

Mutable access to a node's children.

DebugNodes

A struct which borrows from the tree, and allows the debug printing of the tree's node vector, for debugging purposes.

InvalidBranchIndex

Error type for performing operations on a branch index that does not exist in the given branch factor.

NodeIndex

An opaque type which represents the index of a node in a tree. Created for the traverse_from! and traverse_read_from! macros.

NodeOwnedGuard

A owning handle to a detached subtree.

NodeReadGuard

A NodeReadGuard is a type which holds immutable access to a subset of the tree. Because a NodeReadGuard doesn't mutably borrow anything, it does not need to split into a ChildWriteGuard and &mut T. Instead, the NodeReadGuard immutably dereferences to a T, and its children can be accessed directly with a method.

NodeWriteGuard

A NodeWriteGuard is a type which holds mutable access to a subset of the tree (a node and all its children, recursively). The NodeWriteGuard can be simultaneously borrowed into a mutable reference to the element (&mut T) and a ChildWriteGuard. The ChildWriteGuard has the ability to alter the node's children. Additionally, a NodeWriteGuard can be turned into a NodeOwnedGuard, detaching the guarded subtree.

RootTreeAlreadyPresent

Error type for try put root tree.

Tree

The top-level tree type, generic over element type and branch factor.

TreeOperation

A TreeOperation is a type which borrows mutably from the Tree, and allows for modification to that tree. While a TreeOperation exists, the access to the tree can only be single-threaded. This allows many operations to mutate the tree with only a immutable reference to the TreeOperation, directly or indirectly.

TreeReadTraverser

The TreeReadTraverser is to the NodeReadGuard as the TreeWriteTraverser is to the NodeWriteGuard. While the NodeReadGuard holds immutable access to a subset of the tree, a TreeReadTraverser holds immutable access to the entire tree. This allows the TreeReadTraverser to safely traverse to its parent node.

TreeWriteTraverser

While a NodeWriteGuard holds mutable access to a subtree (a node and its children, recursively), a TreeWriteTraverser holds mutable access to an entire tree. This allows a TreeWriteTraverser to seek the parent node, which a NodeWriteGuard cannot do. However, this also means that a TreeWriteTraverser cannot exist at the same time as any other guards.

WrongChildrenNum

An error type for streaming all children, when the output array is of the wrong size.

Enums

AboveMe

Possibilities for what owns a certain node.

NoParent

Error type for trying to traverse upwards when enable.

Traits

GetElemMut

Types that allow a certain node index to be mutably accessed.

IntoReadGuard

Types that can be converted into a NodeReadGuard.

IntoWriteGuard

Types that can be convered into a NodeWriteGuard.

ReadRoot

Types that allow the root to be read.