pub fn spawn_thread_with_return<F, T>(f: F) -> Receiver<T> ⓘExpand description
Spawns a thead to run a sync job returns a
futures::channel::oneshot::Receiver which can be used to get the return
value from f.
See the examples folder for more complete examples.
§Example
let task = || { "hi".to_owned() };
let rx = spawn_thread_with_return(task);
let result = rx.await?; //Only an example, in a real use case use try_recv instead
assert_eq!(result, "hi");