Trait parallel_stream::ParallelStream [−][src]
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>,
{ ... }
}
Expand description
Parallel version of the standard Stream
trait.
Associated Types
Required methods
Attempts to receive the next item from the stream.
Provided methods
Applies f
to each item of this stream in parallel, producing a new
stream with the results.
Applies f
to each item of this stream in parallel, producing a new
stream with the results.
Creates a stream that yields its first n
elements.
Applies f
to each item of this stream in parallel.
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.