diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-05 21:02:35 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-05 22:13:32 -0700 |
| commit | 137e648eddb53b56cd0d3eba992a975456da44d2 (patch) | |
| tree | d892c96d8c5c5f1285ec6f908cee7f7a6563d5dc /src/libstd | |
| parent | 0651d2790c7024d1b450b6b17e34bc8ffdb51a33 (diff) | |
| download | rust-137e648eddb53b56cd0d3eba992a975456da44d2.tar.gz rust-137e648eddb53b56cd0d3eba992a975456da44d2.zip | |
std: Fix a doc example on io::signal
This also makes the listener struct sendable again by explicitly putting the Send bound on the relevant Rtio object. cc #13352
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/signal.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index 494cc6f6b02..6762e7c6a76 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -23,6 +23,7 @@ use clone::Clone; use comm::{Sender, Receiver, channel}; use io; use iter::Iterator; +use kinds::Send; use mem::drop; use option::{Some, None}; use result::{Ok, Err}; @@ -63,25 +64,23 @@ pub enum Signum { /// /// # Example /// -/// ```rust,ignore +/// ```rust,no_run +/// # #![allow(unused_must_use)] /// use std::io::signal::{Listener, Interrupt}; /// /// let mut listener = Listener::new(); /// listener.register(Interrupt); /// -/// spawn({ -/// loop { -/// match listener.rx.recv() { -/// Interrupt => println!("Got Interrupt'ed"), -/// _ => (), -/// } +/// loop { +/// match listener.rx.recv() { +/// Interrupt => println!("Got Interrupt'ed"), +/// _ => (), /// } -/// }); -/// +/// } /// ``` pub struct Listener { /// A map from signums to handles to keep the handles in memory - handles: ~[(Signum, ~RtioSignal)], + handles: ~[(Signum, ~RtioSignal:Send)], /// This is where all the handles send signums, which are received by /// the clients from the receiver. tx: Sender<Signum>, |
