1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -05:00
denoland-deno/cli/tokio_util.rs
2020-01-30 11:28:51 -05:00

15 lines
378 B
Rust

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
#[cfg(test)]
pub fn run<F>(future: F)
where
F: std::future::Future<Output = ()> + Send + 'static,
{
let mut rt = tokio::runtime::Builder::new()
.threaded_scheduler()
.enable_all()
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future);
}