mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
refactor: move mod tokio_util
to runtime (#12332)
This avoids a bunch of duplicated code.
This commit is contained in:
parent
b042697902
commit
f1b1a3f389
9 changed files with 21 additions and 40 deletions
|
@ -13,3 +13,13 @@ pub fn create_basic_runtime() -> tokio::runtime::Runtime {
|
|||
.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 rt = create_basic_runtime();
|
||||
let local = tokio::task::LocalSet::new();
|
||||
local.block_on(&rt, future)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue