[][src]Function abi_stable::external_types::crossbeam_channel::unbounded

pub fn unbounded<T>() -> (RSender<T>, RReceiver<T>)

Creates a channel which can hold an unbounded ammount elements in its internal queue.

Example

use abi_stable::external_types::crossbeam_channel as mpmc;

let (tx,rx)=mpmc::unbounded::<&'static str>();

let join_guard=std::thread::spawn(move||{
    assert_eq!( rx.recv().unwrap(), "foo" );
    assert_eq!( rx.recv().unwrap(), "bar" );
    assert_eq!( rx.recv().unwrap(), "baz" );
    assert!( rx.try_recv().is_err() );
});

tx.send("foo").unwrap();
tx.send("bar").unwrap();
tx.send("baz").unwrap();

join_guard.join().unwrap();