pub struct Tree<L, A = (), const N: usize = 1> { /* private fields */ }
Expand description

An annotated tree structure with an arity of 2N, backed by an mmap.

Each leaf contained in the tree is decorated by an Annotation, computed on the push of said leaf. The change is then propagated up through the tree, recursively combining the annotations of filled subtrees until the root itself is computed.

Leaves can also be popped from tree, and annotations will be kept updated.

Safety

Using an N of 0 will result in a panic when trying to perform any operation.

Implementations

Creates a new tree, mmapped to the file at the given path.

Safety

When a file of length smaller than the tree header (three usizes) exists at the given path, it will be assumed to contain a valid tree. If not, a new file will be created.

Push a leaf to the tree.

Pop the last leaf from the tree.

Returns a reference to the root annotation

Return the number of leaves in the tree

Return the current capacity of the tree.

Return true if the tree is empty

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.