9 releases (5 breaking)

0.6.2 Oct 2, 2019
0.6.1 Jan 18, 2019
0.6.0 Dec 3, 2018
0.5.0 Apr 23, 2018
0.1.0 Jan 10, 2016

#68 in Data structures

Download history 329/week @ 2019-07-22 446/week @ 2019-07-29 557/week @ 2019-08-05 433/week @ 2019-08-12 607/week @ 2019-08-19 582/week @ 2019-08-26 485/week @ 2019-09-02 446/week @ 2019-09-09 613/week @ 2019-09-16 707/week @ 2019-09-23 1087/week @ 2019-09-30 709/week @ 2019-10-07 952/week @ 2019-10-14 872/week @ 2019-10-21 681/week @ 2019-10-28

2,105 downloads per month
Used in 45 crates (2 directly)

ISC license

31KB
704 lines

Ego Tree

Crate version Build status

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;
# fn main() {
let tree = tree!('a' => { 'b', 'c' => { 'd', 'e' } });
# }

No runtime deps