[][src]Trait parallel_stream::prelude::ParallelStream

pub trait ParallelStream: Sized + Send + Sync + Unpin + 'static {
    type Item: Send;
    fn poll_next(
        self: Pin<&mut Self>,
        cx: &mut Context
    ) -> Poll<Option<Self::Item>>;
fn limit(self, limit: impl Into<Option<usize>>) -> Self;
fn get_limit(&self) -> Option<usize>; fn map<F, T, Fut>(self, f: F) -> Map<T>
    where
        F: FnMut(Self::Item) -> Fut + Send + Sync + Copy + 'static,
        T: Send + 'static,
        Fut: Future<Output = T> + Send
, { ... }
fn next(&mut self) -> NextFuture<Self> { ... }
fn take(self, n: usize) -> Take<Self>
    where
        Self: Sized
, { ... }
fn for_each<F, Fut>(self, f: F) -> ForEach
    where
        F: FnMut(Self::Item) -> Fut + Send + Sync + Copy + 'static,
        Fut: Future<Output = ()> + Send
, { ... }
fn collect<'a, B>(self) -> Pin<Box<dyn Future<Output = B> + Send + 'a>>
    where
        Self: Sized + 'a,
        B: FromParallelStream<Self::Item>
, { ... } }

Parallel version of the standard Stream trait.

Associated Types

type Item: Send

The type of items yielded by this stream.

Loading content...

Required methods

fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>>

Attempts to receive the next item from the stream.

fn limit(self, limit: impl Into<Option<usize>>) -> Self

Set a max concurrency limit

fn get_limit(&self) -> Option<usize>

Get the max concurrency limit

Loading content...

Provided methods

fn map<F, T, Fut>(self, f: F) -> Map<T> where
    F: FnMut(Self::Item) -> Fut + Send + Sync + Copy + 'static,
    T: Send + 'static,
    Fut: Future<Output = T> + Send

Applies f to each item of this stream in parallel, producing a new stream with the results.

fn next(&mut self) -> NextFuture<Self>

Applies f to each item of this stream in parallel, producing a new stream with the results.

fn take(self, n: usize) -> Take<Self> where
    Self: Sized

Creates a stream that yields its first n elements.

fn for_each<F, Fut>(self, f: F) -> ForEach where
    F: FnMut(Self::Item) -> Fut + Send + Sync + Copy + 'static,
    Fut: Future<Output = ()> + Send

Applies f to each item of this stream in parallel.

fn collect<'a, B>(self) -> Pin<Box<dyn Future<Output = B> + Send + 'a>> where
    Self: Sized + 'a,
    B: FromParallelStream<Self::Item>, 

Transforms a stream into a collection.

collect() can take anything streamable, and turn it into a relevant collection. This is one of the more powerful methods in the async standard library, used in a variety of contexts.

Loading content...

Implementors

impl<S: ParallelStream> ParallelStream for Take<S>[src]

type Item = S::Item

impl<S: Stream + Send + Sync + Unpin + 'static> ParallelStream for FromStream<S> where
    S::Item: Send
[src]

type Item = S::Item

impl<T: Send + 'static> ParallelStream for Map<T>[src]

type Item = T

impl<T: Send + Sync + 'static> ParallelStream for IntoParStream<T>[src]

type Item = T

Loading content...