Function mesh::mpsc_channel
source · pub fn mpsc_channel<T>() -> (MpscSender<T>, MpscReceiver<T>)where
T: 'static + Send,
Expand description
Creates a multi-producer, single-consumer channel for sending objects of
type T
.
The main difference between these channels and those returned by channel
is that the sender can be cloned and sent to remote processes. This is
useful when you are collating data from multiple sources.
§Performance
Care must be taken to avoid scaling problems with this type. Internally this uses multiple ports between the receiving end and the sending ends, and receiving is linear in the number of ports.
An ordinary call to clone
won’t allocate a new port, nor will sending a
clone within a process. But sending a clone to a different process will
allocate a new port.