signal: change unix::Signal to return () instead of signum (#1330)

* This simplifies the API surface by returning () instead of the signal
number that was used during registration. This also more closely mirrors
the cross-platform `CtrlC` event stream API
* This is a **breaking change**
This commit is contained in:
Ivan Petkov
2019-07-20 15:12:53 -07:00
committed by GitHub
parent 320a5fdca7
commit d9688bc094
5 changed files with 12 additions and 14 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ mod platform {
pub async fn main() {
// Create a stream for each of the signals we'd like to handle.
let sigint = Signal::new(SIGINT).await.unwrap();
let sigterm = Signal::new(SIGTERM).await.unwrap();
let sigint = Signal::new(SIGINT).await.unwrap().map(|_| SIGINT);
let sigterm = Signal::new(SIGTERM).await.unwrap().map(|_| SIGTERM);
// Use the `select` combinator to merge these two streams into one
let stream = stream::select(sigint, sigterm);