amadeus_core/
into_par_stream.rs

1use crate::par_stream::{DistributedStream, ParallelStream, StreamTask};
2
3mod collections;
4mod iterator;
5mod slice;
6pub use self::{collections::*, iterator::*, slice::*};
7
8impl_par_dist_rename! {
9	pub trait IntoParallelStream {
10		type ParStream: ParallelStream<Item = Self::Item>;
11		type Item;
12
13		fn into_par_stream(self) -> Self::ParStream
14		where
15			Self: Sized;
16		#[inline(always)]
17		fn par_stream_mut(&mut self) -> <&mut Self as IntoParallelStream>::ParStream
18		where
19			for<'a> &'a mut Self: IntoParallelStream,
20		{
21			<&mut Self as IntoParallelStream>::into_par_stream(self)
22		}
23		#[inline(always)]
24		fn par_stream(&self) -> <&Self as IntoParallelStream>::ParStream
25		where
26			for<'a> &'a Self: IntoParallelStream,
27		{
28			<&Self as IntoParallelStream>::into_par_stream(self)
29		}
30	}
31
32	impl<T: ParallelStream> IntoParallelStream for T {
33		type ParStream = Self;
34		type Item = <Self as ParallelStream>::Item;
35
36		#[inline(always)]
37		fn into_par_stream(self) -> Self::ParStream
38		where
39			Self: Sized,
40		{
41			self
42		}
43	}
44}