parallel_stream/into_parallel_stream.rs
1use crate::ParallelStream;
2
3/// Conversion into a `ParallelStream`.
4pub trait IntoParallelStream {
5 /// The type of the elements being iterated over.
6 type Item: Send;
7
8 /// Which kind of stream are we turning this into?
9 type IntoParStream: ParallelStream<Item = Self::Item>;
10
11 /// Creates a parallel stream from a value.
12 fn into_par_stream(self) -> Self::IntoParStream;
13}
14
15impl<I: ParallelStream> IntoParallelStream for I {
16 type Item = I::Item;
17 type IntoParStream = I;
18
19 #[inline]
20 fn into_par_stream(self) -> I {
21 self
22 }
23}