channel

Function channel 

Source
pub fn channel<T: Send>() -> (ThreadBeamTx<T>, ThreadBeamRx<T>)
Expand description

Creates a new thread beam channel pair.

Also see spawn for a more convenient way to spawn a thread with a thread beam.

ยงExample

let (tx, rx) = threadbeam::channel();

std::thread::spawn(move || {
    tx.send(String::from("Hello, world!"));
});

let hello = rx.recv();
assert_eq!(hello.as_deref(), Some("Hello, world!"));