(&mut self)
| 62 | type Item = Block; |
| 63 | |
| 64 | fn next(&mut self) -> Option<Block> { |
| 65 | let block = self.stack.pop()?; |
| 66 | |
| 67 | // Collect children into `self.children`, reusing the allocation. |
| 68 | self.children.clear(); |
| 69 | self.children.extend(self.domtree.children(block)); |
| 70 | |
| 71 | // Push in reverse so that the first child ends up on top of the stack |
| 72 | // and is visited first. |
| 73 | self.stack.extend(self.children.iter().rev().copied()); |
| 74 | |
| 75 | Some(block) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /// Pass over a Function that does the whole aegraph thing. |