MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / next

Method next

publication/code/chapter08/rbtree.rs:530–544  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

528impl<'a, K: Ord + Debug, V> Iterator for Iter<'a, K, V> {
529 type Item = &'a RBNode<K, V>;
530 fn next(&mut self) -> Option<Self::Item> {
531 match self.stack.pop() {
532 Some(node) => {
533 let mut next = node.right;
534 unsafe {
535 while !next.is_null() {
536 self.stack.push(&*next);
537 next = (*next).left;
538 }
539 }
540 Some(node)
541 }
542 None => None,
543 }
544 }
545}
546
547struct IterMut<'a, K: Ord + Debug, V> {

Callers

nothing calls this directly

Calls 2

popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected