pub fn spawn<T, R, F>(spawn: F) -> (Option<T>, JoinHandle<R>)Expand description
Helper for spawning a new thread with a beam.
ยงExample
let (hello, thread) = threadbeam::spawn(move |tx| {
tx.send(String::from("Hello, world!"));
// your code...
String::from("Thread completed!")
});
assert_eq!(hello.as_deref(), Some("Hello, world!"));
assert_eq!(thread.join().ok().as_deref(), Some("Thread completed!"));