Skip to content

Commit 22894e7

Browse files
authored
spawn_blocking: Return concrete Task<T> type (#5)
The opaque return type makes storing that value not very useful. And the function return type matches `spawn()` now. Signed-off-by: Mohammad AlSaleh <[email protected]>
1 parent 050c05c commit 22894e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ pub fn spawn_local<F: Future<Output = T> + 'static, T: 'static>(future: F) -> Ta
9797
/// let out = async_global_executor::spawn_blocking(|| Command::new("dir").output()).await?;
9898
/// # std::io::Result::Ok(()) });
9999
/// ```
100-
pub async fn spawn_blocking<F: FnOnce() -> T + Send + 'static, T: Send + 'static>(f: F) -> T {
101-
blocking::unblock(f).await
100+
pub fn spawn_blocking<F: FnOnce() -> T + Send + 'static, T: Send + 'static>(f: F) -> Task<T> {
101+
blocking::unblock(f)
102102
}

0 commit comments

Comments
 (0)