The intended successor of chan
is the crossbeam-channel
crate. Its API is strikingly similar, but comes with a much better select!
macro, better performance, a better test suite and an all-around better implementation.
If you were previously using this crate because of chan-signal
, then it is simple to reproduce a similar API with crossbeam-channel
and the signal-hook
crate. For example, here's chan-signal
's notify
function:
extern crate crossbeam_channel as channel;
extern crate signal_hook;
fn notify(signals: &[c_int]) -> Result<channel::Receiver<c_int>> {
let (s, r) = channel::bounded(100);
let signals = signal_hook::iterator::Signals::new(signals)?;
thread::spawn(move || {
for signal in signals.forever() {
s.send(signal);
}
});
Ok(r)
}
Kudos to @anon15139276 for the amazing work on crossbeam-channel
, and also kudos to @vorner for the amazingly thorough job well done on the signal-hook
crate (which I only just learned about today).