use tokio_threadpool; use self::tokio_threadpool::Builder; use std::future::Future; use std::io; use std::sync::mpsc; pub fn run(f: F) where F: Future> + Send + 'static, { let pool = Builder::new().pool_size(1).build(); let (tx, rx) = mpsc::channel(); pool.spawn(async move { f.await.unwrap(); tx.send(()).unwrap(); }); rx.recv().unwrap() }