diff options
Diffstat (limited to 'runtime/tokio_util.rs')
-rw-r--r-- | runtime/tokio_util.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/tokio_util.rs b/runtime/tokio_util.rs index 7a6f4d49e..695b94802 100644 --- a/runtime/tokio_util.rs +++ b/runtime/tokio_util.rs @@ -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) +} |