[][src]Function futures_ext::spawn_future

pub fn spawn_future<T, E, Fut, IntoFut>(
    f: IntoFut
) -> impl Future<Item = T, Error = E> where
    IntoFut: IntoFuture<Item = T, Error = E, Future = Fut>,
    Fut: Future<Item = T, Error = E> + Send + 'static,
    T: Send + 'static,
    E: From<Canceled> + Send + 'static, 

Take a future, and run it on its own task, returning the result to the caller. This permits Rust to run the spawned future on a different thread to the task that spawned it, thus adding parallelism if used sensibly. Note that the spawning here is lazy - the new task will not be spawned if the returned future is dropped before it's polled.