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

#722 in Data structures

Download history 2045/week @ 2021-04-02 2334/week @ 2021-04-09 2245/week @ 2021-04-16 2029/week @ 2021-04-23 2133/week @ 2021-04-30 2609/week @ 2021-05-07 2274/week @ 2021-05-14 3375/week @ 2021-05-21 2914/week @ 2021-05-28 2447/week @ 2021-06-04 2990/week @ 2021-06-11 2492/week @ 2021-06-18 2979/week @ 2021-06-25 2969/week @ 2021-07-02 3385/week @ 2021-07-09 2257/week @ 2021-07-16

9,989 downloads per month
Used in 142 crates (9 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