[−][src]Crate spmc
SPMC
A single producer, multiple consumers. Commonly used to implement work-stealing.
Example
let (mut tx, rx) = spmc::channel(); let mut handles = Vec::new(); for n in 0..5 { let rx = rx.clone(); handles.push(thread::spawn(move || { let msg = rx.recv().unwrap(); println!("worker {} recvd: {}", n, msg); })); } for i in 0..5 { tx.send(i * 2).unwrap(); } for handle in handles { handle.join().unwrap(); }
Structs
Receiver | The receiving side of a SPMC channel. |
RecvError | |
SendError | An error returned from the |
Sender | The Sending side of a SPMC channel. |
Enums
TryRecvError | This enumeration is the list of the possible reasons that |
Functions
channel | Create a new SPMC channel. |