macro_rules! recv_break {
    ( $rx:tt ) => { ... };
}
Expand description

Wrapper around Receiver<DownMsg<T>>::recv, meant to be used in a loop:

  • if Stop or Err is received, breaks from the parent loop
  • if Pause or Continue are received, do nothing
  • if Other(x) is received, returns x

Example

pool.execute(|_tx, rx| {
    loop {
        let msg = worker_pool::recv_break!(rx);
        // Do something with msg
    }
});