[][src]Trait par_stream::ParFuture

pub trait ParFuture {
    pub fn spawned<T>(self) -> JoinHandle<T>

Notable traits for JoinHandle<T>

impl<T> Future for JoinHandle<T> type Output = T;

    where
        Self: 'static + Future<Output = T> + Send + Sized,
        T: 'static + Send
, { ... } }

An extension trait for Future that provides combinator functions for parallelism.

It simplifies the writing of spawning a parallel task. The following code are equivalent.

use futures::stream::StreamExt;
use par_stream::ParFuture;

#[async_std::main]
async fn main() {
    // original
    async_std::task::spawn(async move {
        println!("a parallel task");
    })
    .await;

    // using the method
    async move {
        println!("a parallel task");
    }
    .spawned()
    .await;
}

Provided methods

pub fn spawned<T>(self) -> JoinHandle<T>

Notable traits for JoinHandle<T>

impl<T> Future for JoinHandle<T> type Output = T;
where
    Self: 'static + Future<Output = T> + Send + Sized,
    T: 'static + Send
[src]

Spawn a task that polls the given future.

Loading content...

Implementors

impl<T, F> ParFuture for F where
    F: Future<Output = T>, 
[src]

Loading content...