async_std/rt/mod.rs
1//! The runtime.
2
3use std::env;
4
5use once_cell::sync::Lazy;
6
7/// Dummy runtime struct.
8pub struct Runtime {}
9
10/// The global runtime.
11pub static RUNTIME: Lazy<Runtime> = Lazy::new(|| {
12 // Create an executor thread pool.
13
14 let thread_name = env::var("ASYNC_STD_THREAD_NAME").unwrap_or_else(|_| "async-std/runtime".to_string());
15 async_global_executor::init_with_config(async_global_executor::GlobalExecutorConfig::default().with_env_var("ASYNC_STD_THREAD_COUNT").with_thread_name_fn(move || thread_name.clone()));
16
17 Runtime {}
18});