fn blocking<R, F>(f: F) -> impl Future<Output = AsyncResult<R>>
where
    R: Send,
    F: FnOnce() -> AsyncResult<R>,
{
    let mut f = Some(f);
    poll_fn(move |_| {
        poll_01_to_03(tokio_threadpool::blocking(|| {
            (f.take().expect("call FnOnce more than once"))()
        }))
    })
    .map_err(AsyncError::NotInPool)
    .unwrap_or_else(|err| Err(err))
}
// Run a closure with blocking IO
Run a closure with blocking IO
Run a closure with blocking IO
fn blocking<R, F>(f: F) -> impl Future<Output = AsyncResult<R>>
where
    R: Send,
    F: FnOnce() -> AsyncResult<R>,
{
    let mut f = Some(f);
    poll_fn(move |_| {
        poll_01_to_03(tokio_threadpool::blocking(|| {
            (f.take().expect("call FnOnce more than once"))()
        }))
    })
    .map_err(AsyncError::NotInPool)
    .unwrap_or_else(|err| Err(err))
}
fn blocking < R , F > ( f : F ) -> impl Future < Output = AsyncResult < R > > where R : Send , F : FnOnce ( ) -> AsyncResult < R > , { let mut f = Some ( f ) ; poll_fn ( move | _ | { poll_01_to_03 ( tokio_threadpool :: blocking ( | | { ( f . take ( ) . expect ( " " ) ) ( ) } ) ) } ) . map_err ( AsyncError :: NotInPool ) . unwrap_or_else ( | err | Err ( err ) ) }
Run a closure with blocking IO
Run a closure with blocking IO
f
F
f
F