#[inline]
pub fn start_with<F: core::future::Future>(fun: F) -> tokio::io::Result<F::Output> {
let mut builder = tokio::runtime::Builder::new_multi_thread();
if std::env::var("TOKIO_ENABLE_ALL")
.map(|str| str.eq("true"))
.unwrap_or(true) {
builder.enable_all();
}
if let Ok(blocking_count) = std::env::var("TOKIO_BLOCKING_THREADS")
.map(|str| str.parse::<usize>().unwrap()) {
builder.max_blocking_threads(blocking_count);
}
if let Ok(worker_threads) = std::env::var("TOKIO_WORKER_THREADS")
.map(|str| str.parse::<usize>().unwrap()) {
builder.worker_threads(worker_threads);
}
if let Ok(thread_stack_size) = std::env::var("TOKIO_THREAD_STACK_SIZE")
.map(|str| str.parse::<usize>().unwrap()) {
builder.thread_stack_size(thread_stack_size);
}
if let Ok(thread_name) = std::env::var("TOKIO_THREAD_NAME") {
builder.thread_name(thread_name);
}
builder.build()
.map(|runtime| runtime.block_on(fun))
}