channel

Function channel 

Source
pub fn channel<T, U>(tx: T, rx: U) -> (CountingSink<T>, CountingStream<U>)
Expand description

Wrap a Sink/Stream pair into a CountingSink and CountingStream pair.

§Correctness

The sink and the stream should match and form a channel: items sent on the sink should be received from the stream.

There should be no other handles in use for adding or removing items from the channel.

If these requirements aren’t met, then the counts returned by the sink and stream will not be accurate.