[][src]Function safina_executor::block_on_unpin

pub fn block_on_unpin<R>(
    fut: impl Future<Output = R> + Send + Unpin + '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.

Note that fut must be Unpin. You can use std::boxed::Box::pin to make it Unpin. The block_on function does this for you. Or use pin_utils::pin_mut to do it with unsafe code that does not allocate memory.