mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
cleanup after tokio upgrade (#3571)
tokio_util::run and tokio::run_on_current_thread should accept Future<Output=()> instead of Future<Output=Result<(), ()>>. Currently, all the passed futures have to add Ok(()) or futures::future::ok(()) unnecessarily to call this method.
This commit is contained in:
parent
4258ed262f
commit
55add2d366
6 changed files with 29 additions and 57 deletions
|
@ -5,7 +5,7 @@ use tokio::runtime;
|
|||
|
||||
pub fn run<F>(future: F)
|
||||
where
|
||||
F: Future<Output = Result<(), ()>> + Send + 'static,
|
||||
F: Future<Output = ()> + Send + 'static,
|
||||
{
|
||||
let mut rt = runtime::Builder::new()
|
||||
.threaded_scheduler()
|
||||
|
@ -13,12 +13,12 @@ where
|
|||
.thread_name("deno")
|
||||
.build()
|
||||
.expect("Unable to create Tokio runtime");
|
||||
rt.block_on(future).unwrap();
|
||||
rt.block_on(future);
|
||||
}
|
||||
|
||||
pub fn run_on_current_thread<F>(future: F)
|
||||
where
|
||||
F: Future<Output = Result<(), ()>> + Send + 'static,
|
||||
F: Future<Output = ()> + Send + 'static,
|
||||
{
|
||||
let mut rt = runtime::Builder::new()
|
||||
.basic_scheduler()
|
||||
|
@ -26,5 +26,5 @@ where
|
|||
.thread_name("deno")
|
||||
.build()
|
||||
.expect("Unable to create Tokio runtime");
|
||||
rt.block_on(future).unwrap();
|
||||
rt.block_on(future);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue