extern crate radix_trie;

use radix_trie::Trie;

fn main() {
    let mut t = Trie::new();
    t.insert("z", 2);
    t.insert("aba", 5);
    t.insert("abb", 6);
    t.insert("abc", 50);

    // This is a bit of a hack that relies on knowing the binary representation of
    // strings... "abd" works, but "abz" doesn't...
    let ab_sum = t.get_raw_ancestor(&"abd").child_iter().fold(0, |acc, c| {
        println!("Iterating over child with value: {:?}", c.value());
        acc + *c.value().unwrap_or(&0)
    });

    println!("{}", ab_sum);
    assert_eq!(ab_sum, 5 + 6 + 50);
}

extern crate radix_trie;

use radix_trie::Trie;

fn main() {
    let mut t = Trie::new();
    t.insert("a", 5);
    t.insert("b", 6);
    t.insert("c", 50);

    let sum = t.child_iter().fold(0, |acc, c| {
        println!("{:#?}", c);
        acc + *c.value().unwrap_or(&0)
    });
    println!("{}", sum);
}

--- 
+++ 
@@ -4,18 +4,13 @@
 
 fn main() {
     let mut t = Trie::new();
-    t.insert("z", 2);
-    t.insert("aba", 5);
-    t.insert("abb", 6);
-    t.insert("abc", 50);
+    t.insert("a", 5);
+    t.insert("b", 6);
+    t.insert("c", 50);
 
-    // This is a bit of a hack that relies on knowing the binary representation of
-    // strings... "abd" works, but "abz" doesn't...
-    let ab_sum = t.get_raw_ancestor(&"abd").child_iter().fold(0, |acc, c| {
-        println!("Iterating over child with value: {:?}", c.value());
+    let sum = t.child_iter().fold(0, |acc, c| {
+        println!("{:#?}", c);
         acc + *c.value().unwrap_or(&0)
     });
-
-    println!("{}", ab_sum);
-    assert_eq!(ab_sum, 5 + 6 + 50);
+    println!("{}", sum);
 }
Add an example of how to iterate through child nodes.
