pub trait IntoFutureExt: IntoFuture + Sizedwhere
<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§
Sourcefn par(self) -> ParallelFuture<Self> ⓘ
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.