1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::par_stream::{DistributedStream, ParallelStream, StreamTask};

mod collections;
mod iterator;
mod slice;
pub use self::{collections::*, iterator::*, slice::*};

impl_par_dist_rename! {
	pub trait IntoParallelStream {
		type ParStream: ParallelStream<Item = Self::Item>;
		type Item;

		fn into_par_stream(self) -> Self::ParStream
		where
			Self: Sized;
		#[inline(always)]
		fn par_stream_mut(&mut self) -> <&mut Self as IntoParallelStream>::ParStream
		where
			for<'a> &'a mut Self: IntoParallelStream,
		{
			<&mut Self as IntoParallelStream>::into_par_stream(self)
		}
		#[inline(always)]
		fn par_stream(&self) -> <&Self as IntoParallelStream>::ParStream
		where
			for<'a> &'a Self: IntoParallelStream,
		{
			<&Self as IntoParallelStream>::into_par_stream(self)
		}
	}

	impl<T: ParallelStream> IntoParallelStream for T {
		type ParStream = Self;
		type Item = <Self as ParallelStream>::Item;

		#[inline(always)]
		fn into_par_stream(self) -> Self::ParStream
		where
			Self: Sized,
		{
			self
		}
	}
}