mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
runtime: allow non-unit type output in {Runtime, Spawner}::spawn (#1756)
This commit is contained in:
@@ -70,7 +70,8 @@ impl Handle {
|
||||
#[cfg(feature = "rt-core")]
|
||||
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
|
||||
where
|
||||
F: Future<Output = ()> + Send + 'static,
|
||||
F: Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
match &self.kind {
|
||||
Kind::Shell => panic!("spawning not enabled for runtime"),
|
||||
|
||||
@@ -299,7 +299,8 @@ impl Runtime {
|
||||
#[cfg(feature = "rt-core")]
|
||||
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
|
||||
where
|
||||
F: Future<Output = ()> + Send + 'static,
|
||||
F: Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
match &self.kind {
|
||||
Kind::Shell(_) => panic!("task execution disabled"),
|
||||
|
||||
Reference in New Issue
Block a user