Is there a better way to do something like below?
use futures::channel::oneshot; // 0.3.4
use std::thread;
pub async fn spawn<Y>(f: impl Fn() -> Y + Send + Sync + 'static) -> Y
where
Y: Send + 'static,
{
let (sender, receiver) = oneshot::channel::<Y>();
thread::spawn(move || sender.send(f()));
receiver.await.unwrap()
}