`spawn` should allow futures with non-unit outputs

This commit is contained in:
Ibraheem Ahmed 2021-06-29 23:58:32 -04:00 committed by GitHub
parent 06b17d6a43
commit 5dadd30bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -160,9 +160,10 @@ pub mod task {
/// # Panics
/// Panics if Actix system is not running.
#[inline]
pub fn spawn<Fut>(f: Fut) -> JoinHandle<()>
pub fn spawn<Fut>(f: Fut) -> JoinHandle<Fut::Output>
where
Fut: Future<Output = ()> + 'static,
Fut: Future + 'static,
Fut::Output: 'static,
{
tokio::task::spawn_local(f)
}