(&mut self)
| 708 | /// `T` can either be an attachment or a new [`Error`] context. |
| 709 | #[must_use] |
| 710 | pub fn downcast_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T> { |
| 711 | // This cannot use `frames_mut` as the found reference needs to outlive the visitor |
| 712 | // closure. Each frame is either returned or descended into, never both, so the borrow |
| 713 | // checker accepts this without `unsafe`. |
| 714 | let mut stack = vec![self.frames.iter_mut()]; |
| 715 | while let Some(frame) = iter::next(&mut stack) { |
| 716 | if frame.is::<T>() { |
| 717 | return frame.downcast_mut(); |
| 718 | } |
| 719 | stack.push(frame.sources_mut().iter_mut()); |
| 720 | } |
| 721 | None |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | impl<C> Report<[C]> { |
no test coverage detected