May 2019
Intermediate to advanced
698 pages
17h 21m
English
One key requirement of the product team was the ability to run simple analytics on top of this set. As a first step, these analytics can be comprised of set operations and comparing their lengths in order to create simple indicators.
One thing that is important, however, is to also get the addresses back out. For that, the implementation this time provides an iterator implementation that consumes the trie and stores it as a Vec<T>, shown as follows:
// [...] trie set implementation pub fn into_iter(self) -> SetIterator<K> { let v: RefCell<Vec<Vec<K>>> = RefCell::new(vec![]); self.walk(|n| v.borrow_mut().push(n.to_vec())); SetIterator::new(v.into_inner(), 0) }}pub struct SetIterator<K>where K: PartialEq + Clone + Ord, ...Read now
Unlock full access