[−][src]Function safina::block_on
pub fn block_on<R>(fut: impl Send + Unpin + Future<Output = R> + 'static) -> R
Executes the future on the current thread and returns its result. Panics if the future panics.
fut
can call spawn
to create tasks.
Those tasks will execute on worker threads even after fut
completes and this thread returns.
std::thread::spawn(safina_executor::work); let result = safina_executor::block_on(Box::pin(async { prepare_request().await?; execute_request().await }))?;