[−][src]Function futures_ext::asynchronize
pub fn asynchronize<Func, T, E>(f: Func) -> impl Future<Item = T, Error = E> where
Func: FnMut() -> Result<T, E> + Send + 'static,
T: Send + 'static,
E: From<BlockingError> + From<Canceled> + Send + 'static,
This method allows us to take synchronous code, schedule it on the default tokio thread pool
and convert it to the future. It's the combination of spawn_future
(which runs a future on
another thread) and closure_to_blocking_future
(which turns a closure into a future).