3 ms·
You don't need any tokio or async/await to use mpsc. It's in the standard library and works just fine with a thread spawned with a closure to work on. It's sp
by monocasa 6y ago
You don't need any tokio or async/await to use mpsc. It's in the standard library and works just fine with a thread spawned with a closure to work on.
It's split into a read half and a write half so you don't have to worry about copy or clone, as an execution context will only have one or the other. I guess you clone the write half to give it to multiple producers, but that's not a huge deal.
The example here for instance doesn't look any more complicated than using go channels, and it's a full executable example you can start by clicking the run button.
https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html