Type Alias Root

Source
pub(super) type Root<K, V> = NodeRef<Owned, K, V, LeafOrInternal>;
Expand description

The root node of an owned tree.

Note that this does not have a destructor, and must be cleaned up manually.

Aliased Type§

struct Root<K, V> {
    height: usize,
    node: NonNull<LeafNode<K, V>>,
    _marker: PhantomData<(Owned, LeafOrInternal)>,
}

Fields§

§height: usize

The number of levels that the node and the level of leaves are apart, a constant of the node that cannot be entirely described by Type, and that the node itself does not store. We only need to store the height of the root node, and derive every other node’s height from it. Must be zero if Type is Leaf and non-zero if Type is Internal.

§node: NonNull<LeafNode<K, V>>

The pointer to the leaf or internal node. The definition of InternalNode ensures that the pointer is valid either way.

§_marker: PhantomData<(Owned, LeafOrInternal)>