pub fn spawn_with_return<F: SpawnableWithReturn<Out>, Out: Spawnable>(
f: F,
) -> Receiver<<Out as Future>::Output> ⓘExpand description
Spawns a async job to run f (the future passed) and 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 = async || { "hi".to_owned() };
let rx = spawn_with_return(task);
let result = rx.await?; //Only an example, in a real use case use try_recv instead
assert_eq!(result, "hi");