signal: Run rustfmt 0.4.2

This commit is contained in:
Markus Westerlind
2018-09-10 11:30:03 -07:00
committed by Carl Lerche
parent 7a24ed7509
commit 2848df9b6c
7 changed files with 155 additions and 105 deletions
+12 -7
View File
@@ -2,9 +2,9 @@ extern crate futures;
extern crate tokio_core;
extern crate tokio_signal;
use futures::{Stream, Future};
use futures::{Future, Stream};
use tokio_core::reactor::Core;
use tokio_signal::unix::{Signal,SIGHUP};
use tokio_signal::unix::{Signal, SIGHUP};
fn main() {
// set up a Tokio event loop
@@ -14,16 +14,21 @@ fn main() {
let stream = Signal::new(SIGHUP, &core.handle()).flatten_stream();
println!("Waiting for SIGHUPS (Ctrl+C to quit)");
println!(" TIP: use `pkill -sighup sighup-example` from a second terminal \
to send a SIGHUP to all processes named 'sighup-example' \
(i.e. this binary)");
println!(
" TIP: use `pkill -sighup sighup-example` from a second terminal \
to send a SIGHUP to all processes named 'sighup-example' \
(i.e. this binary)"
);
// for_each is a powerful primitive provided by the Futures crate
// it turns a Stream into a Future that completes after all stream-items
// have been completed.
let future = stream.for_each(|the_signal| {
println!("*Got signal {:#x}* I should probably reload my config \
or something", the_signal);
println!(
"*Got signal {:#x}* I should probably reload my config \
or something",
the_signal
);
Ok(())
});