Function safina::block_on_unpin[][src]

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.

Does not create an executor. Use Executor::block_on if you need fut to spawn new tasks.

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.

Panics

Panics if the future panics.

Panics if fut calls spawn to create a new task.