Skip to content

Commit

Permalink
Fix child iterator example.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Oct 16, 2016
1 parent 04110c8 commit 90b584c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ target
Cargo.lock
*.swp
*.swo
.DS_Store
.cargo
8 changes: 2 additions & 6 deletions examples/child_iter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate radix_trie;

use radix_trie::Trie;
use radix_trie::{Trie, TrieCommon};

fn main() {
let mut t = Trie::new();
Expand All @@ -9,16 +9,12 @@ fn main() {
t.insert("abb", 6);
t.insert("abc", 50);

// FIXME
// 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| {
let ab_sum = t.get_raw_ancestor(&"abd").children().fold(0, |acc, c| {
println!("Iterating over child with value: {:?}", c.value());
acc + *c.value().unwrap_or(&0)
});
*/
let ab_sum = 0;
println!("{}", ab_sum);
assert_eq!(ab_sum, 5 + 6 + 50);
}

0 comments on commit 90b584c

Please sign in to comment.