Function async_global_executor::init_with_config

source ·
pub fn init_with_config(config: GlobalExecutorConfig)
Expand description

Init the global executor, spawning as many threads as specified or the value specified by the specified environment variable.

§Examples

async_global_executor::init_with_config(
    async_global_executor::GlobalExecutorConfig::default()
        .with_env_var("NUMBER_OF_THREADS")
        .with_min_threads(4)
        .with_max_threads(6)
        .with_thread_name_fn(Box::new(|| "worker".to_string()))
);