Function mesh_channel::mpsc_channel

source ·
pub fn mpsc_channel<T: 'static + Send>() -> (MpscSender<T>, MpscReceiver<T>)
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.