Function doublecross::unbounded[][src]

pub fn unbounded<T, U>() -> (BiChannel<T, U>, BiChannel<U, T>)

Creates a bi-directional channel of unbounded capacity.

This type of channel can hold any number of messages in either direction (ie: it has infinite capacity on both sides)

Type Arguments

Unforunately it is often necessary to annotate types to help the compiler; the type T refers to the type the left channel receives and the right channel sends, and the type U inversely refers to the type the right channel receives and the left channel sends.

Examples

let (left, right) = unbounded::<i32, i32>();
left.send(10);
assert_eq!(right.recv(), Some(10));