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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
mod all; mod any; mod collect; mod combine; mod combiner; mod count; mod fold; mod folder; mod for_each; mod fork; mod group_by; mod histogram; mod max; mod pipe; mod sample; mod sum; mod tuple; use super::par_pipe::*; use crate::{pipe::Sink, pool::ProcessSend}; pub use self::{ all::*, any::*, collect::*, combine::*, combiner::*, count::*, fold::*, folder::*, for_each::*, fork::*, group_by::*, histogram::*, max::*, pipe::*, sample::*, sum::*, tuple::* }; #[must_use] pub trait Reducer<Item> { type Done; type Async: Sink<Item, Done = Self::Done>; fn into_async(self) -> Self::Async; } pub trait ReducerSend<Item>: Reducer<Item, Done = <Self as ReducerSend<Item>>::Done> { type Done: Send + 'static; } pub trait ReducerProcessSend<Item>: ReducerSend<Item, Done = <Self as ReducerProcessSend<Item>>::Done> { type Done: ProcessSend + 'static; } #[must_use] pub trait ParallelSink<Item> { type Done; type Pipe: ParallelPipe<Item>; type ReduceA: ReducerSend<<Self::Pipe as ParallelPipe<Item>>::Output> + Clone + Send; type ReduceC: Reducer< <Self::ReduceA as ReducerSend<<Self::Pipe as ParallelPipe<Item>>::Output>>::Done, Done = Self::Done, >; fn reducers(self) -> (Self::Pipe, Self::ReduceA, Self::ReduceC); } #[inline(always)] pub(crate) fn assert_parallel_sink<R: ParallelSink<Item>, Item>(r: R) -> R { r } #[must_use] pub trait DistributedSink<Item> { type Done; type Pipe: DistributedPipe<Item>; type ReduceA: ReducerSend<<Self::Pipe as DistributedPipe<Item>>::Output> + Clone + ProcessSend + Send; type ReduceB: ReducerProcessSend< <Self::ReduceA as ReducerSend<<Self::Pipe as DistributedPipe<Item>>::Output>>::Done, > + Clone + ProcessSend; type ReduceC: Reducer< <Self::ReduceB as ReducerProcessSend< <Self::ReduceA as ReducerSend<<Self::Pipe as DistributedPipe<Item>>::Output>>::Done, >>::Done, Done = Self::Done, >; fn reducers(self) -> (Self::Pipe, Self::ReduceA, Self::ReduceB, Self::ReduceC); } #[inline(always)] pub(crate) fn assert_distributed_sink<R: DistributedSink<Item>, Item>(r: R) -> R { r }