Visits every [`Frame`] of the report mutably, in the same order as [`frames()`]. Returning [`ControlFlow::Break`] from `visitor` stops the traversal early. The break is propagated to the caller, a full traversal returns [`ControlFlow::Continue`]. This is deliberately not an [`Iterator`]: an iterator over `&mut Frame` hands out references whose lifetimes are independent of each other, so a frame
(
&mut self,
mut visitor: impl FnMut(&mut Frame) -> ControlFlow<()>,
)
| 624 | /// |
| 625 | /// [`frames()`]: Self::frames |
| 626 | pub fn frames_mut( |
| 627 | &mut self, |
| 628 | mut visitor: impl FnMut(&mut Frame) -> ControlFlow<()>, |
| 629 | ) -> ControlFlow<()> { |
| 630 | // If lending iterators ever land in `core`, this should become one: yielding `&mut Frame` |
| 631 | // bound to the `next()` borrow is sound and more ergonomic than a visitor. |
| 632 | let mut stack = vec![self.frames.iter_mut()]; |
| 633 | while let Some(frame) = iter::next(&mut stack) { |
| 634 | visitor(frame)?; |
| 635 | stack.push(frame.sources_mut().iter_mut()); |
| 636 | } |
| 637 | ControlFlow::Continue(()) |
| 638 | } |
| 639 | |
| 640 | /// Creates an iterator of references of type `T` that have been [`attached`](Self::attach) or |
| 641 | /// that are [`provide`](Error::provide)d by [`Error`] objects. |