dash_sdk::sync

Function block_on

source
pub fn block_on<F>(fut: F) -> Result<F::Output, AsyncError>
where F: Future + Send + 'static, F::Output: Send,
Expand description

Blocks on the provided future and returns the result.

This function is used to call async functions from sync code. Requires the current thread to be running in a tokio runtime.

Due to limitations of tokio runtime, we cannot use tokio::runtime::Runtime::block_on if we are already inside a tokio runtime. This function is a workaround for that limitation.