deno_simple_runtime 0.68.0

Provides the deno runtime library
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.

pub fn create_basic_runtime() -> tokio::runtime::Runtime {
        // This limits the number of threads for blocking operations (like for
        // synchronous fs ops) or CPU bound tasks like when we run dprint in
        // parallel for deno fmt.
        // The default value is 512, which is an unhelpfully large thread pool. We
        // don't ever want to have more than a couple dozen threads.

// TODO(ry) rename to run_local ?
pub fn run_basic<F, R>(future: F) -> R
    F: std::future::Future<Output = R>,
    let rt = create_basic_runtime();
    let local = tokio::task::LocalSet::new();
    local.block_on(&rt, future)