(&self, fut: F)
| 119 | |
| 120 | impl NapiRuntime { |
| 121 | fn spawn<F>(&self, fut: F) -> tokio::task::JoinHandle<F::Output> |
| 122 | where |
| 123 | F: Future + Send + 'static, |
| 124 | F::Output: Send + 'static, |
| 125 | { |
| 126 | // Try the current runtime first; otherwise use the binding-owned runtime. |
| 127 | if let Ok(handle) = tokio::runtime::Handle::try_current() { |
| 128 | handle.spawn(fut) |
| 129 | } else { |
| 130 | fallback_runtime().spawn(fut) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | fn block_on<F: Future>(&self, fut: F) -> F::Output { |
| 135 | if let Ok(handle) = tokio::runtime::Handle::try_current() { |
no test coverage detected