MCPcopy Create free account
hub / github.com/hashintel/hash / frames_mut

Method frames_mut

libs/error-stack/src/report.rs:626–638  ·  view source on GitHub ↗

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<()>,
    )

Source from the content-addressed store, hash-verified

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.

Callers 7

iter_mutFunction · 0.80
iter_mut_breakFunction · 0.80
opaque_attachmentFunction · 0.80
sourcesFunction · 0.80
printable_attachmentFunction · 0.80
contextFunction · 0.80
mainFunction · 0.80

Calls 4

sources_mutMethod · 0.80
nextFunction · 0.70
pushMethod · 0.65
iter_mutMethod · 0.45

Tested by 7

iter_mutFunction · 0.64
iter_mut_breakFunction · 0.64
opaque_attachmentFunction · 0.64
sourcesFunction · 0.64
printable_attachmentFunction · 0.64
contextFunction · 0.64
mainFunction · 0.64