8个版本 (5个重大更新)

使用旧Rust 2015

0.6.1 2020年7月9日
0.6.0 2020年3月3日
0.5.0 2018年10月18日
0.4.1 2018年9月3日
0.1.0 2018年4月9日

#1340 in 数据结构

MIT/Apache

16KB
248

tree-index

crates.io version build status downloads docs.rs docs

有状态的树索引。或者说,是有状态的平面树。这是将平面树与稀疏位字段结合的结果——非常酷!

改编自 mafintosh/hypercore/lib/tree-index.js

用法

extern crate sparse_bitfield as bitfield;
extern crate tree_index;

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

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

安装

$ cargo add tree-index

许可

MIT OR Apache-2.0

依赖

~55KB