Joins the task using a mutable reference and unwinds the panic if it happens. This method is similar to [`join_unwind`](Self::join_unwind), but takes a mutable reference instead of consuming `self`. This allows the `SpawnedTask` to remain usable after the call. If called multiple times on the same task: - If the task is still running, it will continue waiting for completion - If the task has alr
(&mut self)
| 85 | /// - If the task panicked, the first call will resume the panic, and the |
| 86 | /// program will not reach subsequent calls |
| 87 | pub async fn join_unwind_mut(&mut self) -> Result<R, JoinError> { |
| 88 | self.await.map_err(|e| { |
| 89 | // `JoinError` can be caused either by panic or cancellation. We have to handle panics: |
| 90 | if e.is_panic() { |
| 91 | std::panic::resume_unwind(e.into_panic()); |
| 92 | } else { |
| 93 | log::warn!("SpawnedTask was polled during shutdown"); |
| 94 | e |
| 95 | } |
| 96 | }) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | impl<R> Future for SpawnedTask<R> { |