[−][src]Function tokio_safe_block_on::tokio_safe_block_on
pub fn tokio_safe_block_on<F>(
f: F,
timeout: Duration
) -> Result<F::Output, BlockOnError> where
F: 'static + Future + Send,
<F as Future>::Output: Send,
Provides the ability to execute async code from a sync context,
without blocking a tokio core thread or busy looping the cpu.
You must ensure you are within the context of a tokio::task,
This allows tokio::task::block_in_place
to move to a blocking thread.