9 releases (5 breaking)

Uses old Rust 2015

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

#163 in Data structures

Download history 37168/week @ 2024-01-15 36795/week @ 2024-01-22 43019/week @ 2024-01-29 31911/week @ 2024-02-05 40780/week @ 2024-02-12 40782/week @ 2024-02-19 48687/week @ 2024-02-26 49565/week @ 2024-03-04 43321/week @ 2024-03-11 48996/week @ 2024-03-18 49165/week @ 2024-03-25 54037/week @ 2024-04-01 33292/week @ 2024-04-08 46967/week @ 2024-04-15 47360/week @ 2024-04-22 45958/week @ 2024-04-29

176,435 downloads per month
Used in 488 crates (42 directly)

ISC license

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

No runtime deps