Struct tree_index::TreeIndex[][src]

pub struct TreeIndex { /* fields omitted */ }

Index a tree structure or something.

Methods

impl TreeIndex
[src]

Create a new TreeIndex by passing it a sparse_bitfield instance.

Get a bit from the bitfield.

Set an index on the tree to true, and also all of the parents to the index. Walks the flat-tree upward, until it finds the upper most node.

Prove a method.

Determine which Nodes prove the correctness for the Node at index.

The passed buffer is filled with nodes that are verified by the same index. This is done so allocations can happen at the top level, and a buffer (pool) can be used to prevent extra allocations.

Create a digest for data at index.

Get the position of the highest entry in the tree. Aka max.

NOTE: should we rename this to .len() ?

Examples

       3
   1       5
 0   2   4   6
extern crate tree_index as tree;
use tree::{Change, TreeIndex, Verification};

let mut tree = TreeIndex::default();
for i in (0..8).step_by(2) {
  tree.set(i);
}
assert_eq!(tree.blocks(), 4);
tree = TreeIndex::default();
tree.set(1);
tree.set(5);
assert_eq!(tree.blocks(), 4);
tree = TreeIndex::default();
tree.set(3);
assert_eq!(tree.blocks(), 4);

Get all root nodes.

TODO: don't make this allocate, but fill a vector instead.

Find the node that verified the node that's passed.

This is different from the Javascript implementation in that it doesn't push the top value into an array, but returns it instead through the Verification type.

Trait Implementations

impl Debug for TreeIndex
[src]

Formats the value using the given formatter. Read more

impl Default for TreeIndex
[src]

Create a TreeIndex with an empty sparse_bitfield instance with a page size of 1024.

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for TreeIndex

impl Sync for TreeIndex