9 releases (5 breaking)
Uses old Rust 2015
0.6.2 | Oct 2, 2019 |
---|---|
0.6.1 |
|
0.6.0 | Dec 3, 2018 |
0.5.0 | Apr 23, 2018 |
0.1.0 | Jan 10, 2016 |
#174 in Data structures
192,055 downloads per month
Used in 472 crates
(38 directly)
32KB
704 lines
Ego Tree
Vec-backed ID-tree.
lib.rs
:
Vec-backed ID-tree.
Behavior
- Trees have at least a root node;
- Nodes have zero or more ordered children;
- Nodes have at most one parent;
- Nodes can be detached (orphaned) but not removed;
- Node parent, next sibling, previous sibling, first child and last child can be accessed in constant time;
- All methods perform in constant time;
- All iterators perform in linear time.
Examples
let mut tree = ego_tree::Tree::new('a');
let mut root = tree.root_mut();
root.append('b');
let mut c = root.append('c');
c.append('d');
c.append('e');
#[macro_use] extern crate ego_tree;
let tree = tree!('a' => { 'b', 'c' => { 'd', 'e' } });