@@ -292,7 +292,11 @@ fn signal_enable(signal: SignalKind, handle: &Handle) -> io::Result<()> {
292
292
}
293
293
}
294
294
295
- /// A stream of events for receiving a particular type of OS signal.
295
+ /// An listener for receiving a particular type of OS signal.
296
+ ///
297
+ /// The listener can be turned into a `Stream` using [`SignalStream`].
298
+ ///
299
+ /// [`SignalStream`]: https://docs.rs/tokio-stream/latest/tokio_stream/wrappers/struct.SignalStream.html
296
300
///
297
301
/// In general signal handling on Unix is a pretty tricky topic, and this
298
302
/// structure is no exception! There are some important limitations to keep in
@@ -307,7 +311,7 @@ fn signal_enable(signal: SignalKind, handle: &Handle) -> io::Result<()> {
307
311
/// Once `poll` has been called, however, a further signal is guaranteed to
308
312
/// be yielded as an item.
309
313
///
310
- /// Put another way, any element pulled off the returned stream corresponds to
314
+ /// Put another way, any element pulled off the returned listener corresponds to
311
315
/// *at least one* signal, but possibly more.
312
316
///
313
317
/// * Signal handling in general is relatively inefficient. Although some
@@ -345,11 +349,11 @@ fn signal_enable(signal: SignalKind, handle: &Handle) -> io::Result<()> {
345
349
/// #[tokio::main]
346
350
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
347
351
/// // An infinite stream of hangup signals.
348
- /// let mut stream = signal(SignalKind::hangup())?;
352
+ /// let mut sig = signal(SignalKind::hangup())?;
349
353
///
350
354
/// // Print whenever a HUP signal is received
351
355
/// loop {
352
- /// stream .recv().await;
356
+ /// sig .recv().await;
353
357
/// println!("got signal HUP");
354
358
/// }
355
359
/// }
@@ -360,7 +364,7 @@ pub struct Signal {
360
364
inner : RxFuture ,
361
365
}
362
366
363
- /// Creates a new stream which will receive notifications when the current
367
+ /// Creates a new listener which will receive notifications when the current
364
368
/// process receives the specified signal `kind`.
365
369
///
366
370
/// This function will create a new stream which binds to the default reactor.
0 commit comments