mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
19 lines
439 B
Rust
19 lines
439 B
Rust
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
pub fn create_basic_runtime() -> tokio::runtime::Runtime {
|
|
tokio::runtime::Builder::new()
|
|
.basic_scheduler()
|
|
.enable_io()
|
|
.enable_time()
|
|
.build()
|
|
.unwrap()
|
|
}
|
|
|
|
// TODO(ry) rename to run_local ?
|
|
pub fn run_basic<F, R>(future: F) -> R
|
|
where
|
|
F: std::future::Future<Output = R>,
|
|
{
|
|
let mut rt = create_basic_runtime();
|
|
rt.block_on(future)
|
|
}
|