3 ms·
> Rust one you mention is multiple-producer single-consumer. And it is not nearly as feature rich as a channel in Go. By the time one deals with tokio, async/aw
by masklinn 6y ago
> Rust one you mention is multiple-producer single-consumer. And it is not nearly as feature rich as a channel in Go. By the time one deals with tokio, async/await, passing the (rx,tx) to the right thread with clone()/copy(), the developer would be tired.
tokio and async/await have little to do with channels (other than having their own async-aware versions).
If you need a real mpmc channel, crossbeam[0] provides one. The interface is similar to the stdlib's, but you can clone the receiver as well as the sender.
[0] https://docs.rs/crossbeam/0.8.0/crossbeam/channel/index.html https://docs.rs/crossbeam/0.8.0/crossbeam/channel/index.html
- harikb 6y agotokio use is often not by choice. web service might need hyper.rs, which uses tokio underneath. Put a crossbeam non-async call in between and one would bring concurrency to a stop.