Trait parallel_future::IntoFutureExt

source ·
pub trait IntoFutureExt: IntoFuture + Sized
where <Self as IntoFuture>::IntoFuture: Send + 'static, <Self as IntoFuture>::Output: Send + 'static,
{ // Provided method fn par(self) -> ParallelFuture<<Self as IntoFuture>::IntoFuture> { ... } }
Expand description

Extend the Future trait.

Provided Methods§

source

fn par(self) -> ParallelFuture<<Self as IntoFuture>::IntoFuture>

Convert this future into a parallelizable future.

§Examples
use parallel_future::prelude::*;
use futures_concurrency::prelude::*;

async_std::task::block_on(async {
    let a = async { 1 }.par();        // ← returns `ParallelFuture`
    let b = async { 2 }.par();        // ← returns `ParallelFuture`

    let (a, b) = (a, b).join().await; // ← concurrent `.await`
    assert_eq!(a + b, 3);
})

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Fut> IntoFutureExt for Fut
where Fut: IntoFuture, <Fut as IntoFuture>::IntoFuture: Send + 'static, <Fut as IntoFuture>::Output: Send + 'static,