runtime: allow non-unit type output in {Runtime, Spawner}::spawn (#1756)

This commit is contained in:
Taiki Endo
2019-11-15 22:16:21 -08:00
committed by Carl Lerche
parent 92eb635669
commit 1474794055
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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"),
+2 -1
View File
@@ -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"),