1 unstable release

Uses old Rust 2015

0.0.1 Mar 20, 2015

#32 in #binary-search-tree

MIT/Apache

105KB
2K SLoC

An ordered map and set based on a binary search tree.

Documentation is available at https://contain-rs.github.io/bst/bst.

To use bst with Cargo, add this to Cargo.toml:

[dependencies]
bst = "*"

and this to the crate root:

extern crate bst;

lib.rs:

Maps are collections of unique keys with corresponding values, and sets are just unique keys without a corresponding value.

This crate defines the TreeMap and TreeSet types. Their keys must implement Ord.

TreeMaps are ordered.

Examples

use bst::TreeSet;

let mut tree_set = TreeSet::new();

tree_set.insert(2);
tree_set.insert(1);
tree_set.insert(3);

for i in tree_set.iter() {
   println!("{}", i) // prints 1, then 2, then 3
}

Dependencies

~230KB