util: implement FusedStream for Jobs (#2031)

This commit is contained in:
Andronik Ordian
2020-11-28 23:14:37 +01:00
committed by GitHub
parent d6307a4978
commit bbb036e304
+12 -1
View File
@@ -674,6 +674,17 @@ where
}
}
impl<Spawner, Job> stream::FusedStream for Jobs<Spawner, Job>
where
Spawner: SpawnNamed,
Job: JobTrait,
{
fn is_terminated(&self) -> bool {
false
}
}
/// A basic implementation of a subsystem.
///
/// This struct is responsible for handling message traffic between
@@ -762,7 +773,7 @@ where
).await {
break
},
outgoing = jobs.next().fuse() => {
outgoing = jobs.next() => {
if let Err(e) = Self::handle_from_job(outgoing, &mut ctx).await {
tracing::warn!(err = ?e, "failed to handle command from job");
}