tree-index

crates.io version build status downloads docs.rs docs

Stateful tree index. Or well, stateful flat-tree. It's what happens when you combine a flat-tree with a sparse-bitfield - which ends up being pretty cool!

Adapted from mafintosh/hypercore/lib/tree-index.js.

Usage

```rust extern crate sparsebitfield as bitfield; extern crate treeindex;

use tree_index::TreeIndex; use self::bitfield::{Bitfield, Change};

let bitfield = Bitfield::new(1024); let mut tree = TreeIndex::new(bitfield); asserteq!(tree.set(0), Change::Changed); asserteq!(tree.set(0), Change::Unchanged); asserteq!(tree.get(0), true); asserteq!(tree.get(1), false); ```

Installation

sh $ cargo add tree-index

License

MIT OR Apache-2.0