(task: T)
| 50 | } |
| 51 | |
| 52 | pub fn spawn_blocking<T>(task: T) -> Self |
| 53 | where |
| 54 | T: FnOnce() -> R, |
| 55 | T: Send + 'static, |
| 56 | R: Send, |
| 57 | { |
| 58 | // Ok to use spawn_blocking here as SpawnedTask handles aborting/cancelling the task on Drop |
| 59 | #[expect(clippy::disallowed_methods)] |
| 60 | let inner = tokio::task::spawn_blocking(trace_block(task)); |
| 61 | Self { inner } |
| 62 | } |
| 63 | |
| 64 | /// Joins the task, returning the result of join (`Result<R, JoinError>`). |
| 65 | /// Same as awaiting the spawned task, but left for backwards compatibility. |