> This is completely the opposite: in Rust you have an explicit sender and an explicit receiver, and you have no control on the channel that was created. Only this sender can send to the pipe, and only this receiver can receive.
Its not "completely the opposite", though it is different. Rust doesn't let multiple tasks use the same sender handle, but supports multiple senders on the same channel by cloning the sender handle (same with the receiver handle, mutatis mutandis.)
So your Go code becomes something like this in Rust (the only substantive difference is the need to clone the sender handle):
let (tx, rx) = channel();
spawn(proc() {
tx.send(1);
});
tx2 = tx.clone();
spawn(proc() {
tx2.send(2);
});
for a in rx.iter() {
// As in the Go example, process the stuff coming down
// the channel with no expected order or knowledge of
// who sent to it.
}