#stable #binary-search-tree #set #ordered #map #key

stable_bst

An ordered map and set based on a binary search tree. Works with stable Rust 1.9.0.

4 releases (2 breaking)

Uses old Rust 2015

0.2.0 Aug 19, 2016
0.1.0 Jul 9, 2016
0.0.2 Jul 7, 2016
0.0.1 Jul 7, 2016

#1859 in Data structures

Download history 4044/week @ 2024-01-20 4820/week @ 2024-01-27 5626/week @ 2024-02-03 6130/week @ 2024-02-10 7581/week @ 2024-02-17 14847/week @ 2024-02-24 6428/week @ 2024-03-02 5317/week @ 2024-03-09 3436/week @ 2024-03-16 6364/week @ 2024-03-23 3747/week @ 2024-03-30 6310/week @ 2024-04-06 6332/week @ 2024-04-13 8034/week @ 2024-04-20 6471/week @ 2024-04-27 1592/week @ 2024-05-04

23,337 downloads per month
Used in 4 crates (via rustfst)

MIT/Apache

270KB
2.5K SLoC

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

Forked from https://github.com/contain-rs/bst and updated to work with stable Rust (1.9.0).

Documentation here; crate here.


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 stable_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