Trait parallel_future::IntoFutureExt
source · pub trait IntoFutureExt: IntoFuture + Sizedwhere
<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§
sourcefn par(self) -> ParallelFuture<<Self as IntoFuture>::IntoFuture> ⓘ
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.