pub trait ParallelStream:
Sized
+ Send
+ Sync
+ Unpin
+ 'static {
type Item: Send;
// Required methods
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>;
// 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 { ... }
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.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn map<F, T, Fut>(self, f: F) -> Map<T>
fn map<F, T, Fut>(self, f: F) -> Map<T>
Applies f to each item of this stream in parallel, producing a new
stream with the results.
Sourcefn next(&mut self) -> NextFuture<'_, Self>
fn next(&mut self) -> NextFuture<'_, Self>
Applies f to each item of this stream in parallel, producing a new
stream with the results.
Sourcefn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Creates a stream that yields its first n elements.
Sourcefn for_each<F, Fut>(self, f: F) -> ForEach ⓘ
fn for_each<F, Fut>(self, f: F) -> ForEach ⓘ
Applies f to each item of this stream in parallel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".