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

Method iter

publication/code/chapter08/rbtree.rs:499–509  ·  view source on GitHub ↗

迭代函数,包括 mut 版本

(&self)

Source from the content-addressed store, hash-verified

497
498 // 迭代函数,包括 mut 版本
499 fn iter<'a>(&self) -> Iter<'a, K, V> {
500 let mut iterator = Iter { stack: Vec::new() };
501 let mut node = self.root;
502 unsafe {
503 while !node.is_null() {
504 iterator.stack.push(&*node);
505 node = (*node).left;
506 }
507 }
508 iterator
509 }
510
511 fn iter_mut<'a>(&mut self) -> IterMut<'a, K, V> {
512 let mut iterator = IterMut { stack: Vec::new() };

Callers 4

orderFunction · 0.45
iterFunction · 0.45
insertFunction · 0.45
deleteFunction · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected