store-interval-tree

Crates.iostore-interval-tree
lib.rsstore-interval-tree
version0.4.0
sourcesrc
created_at2022-10-13 12:35:32.255536
updated_at2022-11-22 10:21:32.293394
descriptionA balanced unbounded interval-tree in Rust with associated values in the nodes
homepage
repositoryhttps://github.com/andreafioraldi/store-interval-tree
max_upload_size
id687139
size92,387
AFLplusplus (aflpp)

documentation

https://docs.rs/store-interval-tree

README

store-interval-tree

A balanced unbounded interval-tree in Rust with associated values in the nodes.

Based on rudac and bio.

Example

use store_interval_tree::IntervalTree;
use store_interval_tree::Interval;
use std::ops::Bound::*;

let mut interval_tree = IntervalTree::<usize, bool>::new();

interval_tree.insert(Interval::new(Excluded(0), Included(1)), true);
interval_tree.insert(Interval::new(Included(0), Excluded(3)), true);
interval_tree.insert(Interval::new(Included(6), Included(10)), true);
interval_tree.insert(Interval::new(Excluded(8), Included(9)), true);
interval_tree.insert(Interval::new(Excluded(15), Excluded(23)), true);
interval_tree.insert(Interval::new(Included(16), Excluded(21)), true);
interval_tree.insert(Interval::new(Included(17), Excluded(19)), true);
interval_tree.insert(Interval::new(Excluded(19), Included(20)), true);
interval_tree.insert(Interval::new(Excluded(25), Included(30)), true);
interval_tree.insert(Interval::new(Included(26), Included(26)), true);

let interval = Interval::new(Included(8), Included(26));
let iter = interval_tree.query_mut(&interval);

for mut entry in iter {
    *entry.value() = false;
}
Commit count: 9

cargo fmt