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

#174 in Data structures

Download history 39627/week @ 2023-12-06 34828/week @ 2023-12-13 23015/week @ 2023-12-20 22718/week @ 2023-12-27 36971/week @ 2024-01-03 34929/week @ 2024-01-10 40149/week @ 2024-01-17 36996/week @ 2024-01-24 39056/week @ 2024-01-31 35621/week @ 2024-02-07 37933/week @ 2024-02-14 46612/week @ 2024-02-21 47988/week @ 2024-02-28 50181/week @ 2024-03-06 42867/week @ 2024-03-13 42181/week @ 2024-03-20

192,055 downloads per month
Used in 472 crates (38 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