1 2 3 4 5 6 7 8 9
use std::sync::OnceLock; use tokio::runtime::Runtime; static RUNTIME: OnceLock<Runtime> = OnceLock::new(); pub fn runtime() -> &'static Runtime { RUNTIME.get_or_init(|| Runtime::new().expect("Failed to create Tokio runtime")) }