Implement Stream for signal::unix::Signal (#1849)

Refs #1848
This commit is contained in:
Ömer Sinan Ağacan
2019-11-28 08:54:50 -08:00
committed by Ivan Petkov
parent 524e66314f
commit cd73951130
+10
View File
@@ -404,6 +404,16 @@ impl Signal {
}
}
cfg_stream! {
impl futures_core::Stream for Signal {
type Item = ();
fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.poll_recv(cx)
}
}
}
pub(crate) fn ctrl_c() -> io::Result<Signal> {
signal(SignalKind::interrupt())
}