use std::future::Future;
use std::io;
pub fn block_on<F, T>(future: F) -> T
where
F: Future<Output = T>,
{
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("failed to create tokio runtime")
.block_on(future)
}
pub fn try_block_on<F, T>(future: F) -> io::Result<T>
where
F: Future<Output = T>,
{
Ok(tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()?
.block_on(future))
}