()
| 425 | static RUNTIME: OnceLock<Runtime> = OnceLock::new(); |
| 426 | |
| 427 | pub fn get_runtime() -> &'static Runtime { |
| 428 | RUNTIME.get_or_init(|| { |
| 429 | Builder::new_multi_thread() |
| 430 | .enable_all() |
| 431 | // Optional: limit threads if you want to leave room for Python |
| 432 | .worker_threads(4) |
| 433 | .build() |
| 434 | .expect("Failed to create Tokio runtime") |
| 435 | }) |
| 436 | } |
| 437 | |
| 438 | pub fn block_on<F: Future>(future: F) -> F::Output { |
| 439 | get_runtime().block_on(future) |
no test coverage detected