[−][src]Crate drop_worker
Provides helpful worker threads that get joined when dropped.
Features
The crossbeam
feature will use unbounded crossbeam channels instead of std channels.
Example
#[macro_use] extern crate drop_worker; use drop_worker::{recv_data, try_err, DropWorker, Receiver}; fn main() { let _worker = DropWorker::new(work); let mut receiver = DropWorker::new(rec); receiver.send(5); } fn work(recv: Receiver<()>) { // setup loop { try_err!(recv); // do work } } fn rec(recv: Receiver<usize>) { loop { let data = recv_data!(recv); assert_eq!(data, 5); } }
Macros
recv_data | Waits for data from the |
try_err | Checks if the |
Structs
DropWorker | Provides a worker thread that can receive structs of type |
Receiver | The receiving half of Rust's |
Enums
TryRecvError | This enumeration is the list of the possible reasons that |