Trait 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> { ... } }
Expand description

Extend the Future trait.

Provided Methods§

Source

fn par(self) -> ParallelFuture<Self>

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);
})

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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,