Skip to content

Commit 90b584c

Browse files
committedOct 16, 2016
Fix child iterator example.
1 parent 04110c8 commit 90b584c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ target
22
Cargo.lock
33
*.swp
44
*.swo
5+
.DS_Store
56
.cargo

‎examples/child_iter.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern crate radix_trie;
22

3-
use radix_trie::Trie;
3+
use radix_trie::{Trie, TrieCommon};
44

55
fn main() {
66
let mut t = Trie::new();
@@ -9,16 +9,12 @@ fn main() {
99
t.insert("abb", 6);
1010
t.insert("abc", 50);
1111

12-
// FIXME
1312
// This is a bit of a hack that relies on knowing the binary representation of
1413
// strings... "abd" works, but "abz" doesn't...
15-
/*
16-
let ab_sum = t.get_raw_ancestor(&"abd").child_iter().fold(0, |acc, c| {
14+
let ab_sum = t.get_raw_ancestor(&"abd").children().fold(0, |acc, c| {
1715
println!("Iterating over child with value: {:?}", c.value());
1816
acc + *c.value().unwrap_or(&0)
1917
});
20-
*/
21-
let ab_sum = 0;
2218
println!("{}", ab_sum);
2319
assert_eq!(ab_sum, 5 + 6 + 50);
2420
}

0 commit comments

Comments
 (0)