Use regular tokio::task::spawn in native context

This commit is contained in:
Mononaut 2023-10-14 01:44:37 +00:00
parent d23a8c1b7a
commit d8cc9fc54c
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -2,13 +2,12 @@ use std::time::Duration;
use tokio::task::JoinHandle;
use futures_util::Future;
#[cfg(not(target_arch = "wasm32"))]
pub fn spawn<F>(future: F) -> Option<JoinHandle<F::Output>>
where
F: Future + 'static,
F::Output: 'static
F: Future + Send + 'static,
F::Output: Send + 'static,
{
Some(tokio::task::spawn_local(future))
Some(tokio::task::spawn(future))
}
#[cfg(target_arch = "wasm32")]