[][src]Function hyperdrive::blocking

pub fn blocking<F, T, E>(f: F) -> impl Future<Item = T, Error = E> where
    F: FnOnce() -> Result<T, E>, 

Turns a blocking closure into an asynchronous Future.

This function takes a blocking closure that does synchronous I/O or heavy computations, and turns it into a well-behaved asynchronous Future by running it on a thread pool.

The returned future will have 'static lifetime if the passed closure and the success and error types do.

This is a convenience wrapper around tokio_threadpool::blocking.