/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.11.0/src/iter/noop.rs
Line | Count | Source |
1 | | use super::plumbing::*; |
2 | | |
3 | | pub(super) struct NoopConsumer; |
4 | | |
5 | | impl<T> Consumer<T> for NoopConsumer { |
6 | | type Folder = NoopConsumer; |
7 | | type Reducer = NoopReducer; |
8 | | type Result = (); |
9 | | |
10 | 0 | fn split_at(self, _index: usize) -> (Self, Self, NoopReducer) { |
11 | 0 | (NoopConsumer, NoopConsumer, NoopReducer) |
12 | 0 | } |
13 | | |
14 | 0 | fn into_folder(self) -> Self { |
15 | 0 | self |
16 | 0 | } |
17 | | |
18 | 0 | fn full(&self) -> bool { |
19 | 0 | false |
20 | 0 | } |
21 | | } |
22 | | |
23 | | impl<T> Folder<T> for NoopConsumer { |
24 | | type Result = (); |
25 | | |
26 | 0 | fn consume(self, _item: T) -> Self { |
27 | 0 | self |
28 | 0 | } |
29 | | |
30 | 0 | fn consume_iter<I>(self, iter: I) -> Self |
31 | 0 | where |
32 | 0 | I: IntoIterator<Item = T>, |
33 | | { |
34 | 0 | iter.into_iter().for_each(drop); |
35 | 0 | self |
36 | 0 | } |
37 | | |
38 | 0 | fn complete(self) {} |
39 | | |
40 | 0 | fn full(&self) -> bool { |
41 | 0 | false |
42 | 0 | } |
43 | | } |
44 | | |
45 | | impl<T> UnindexedConsumer<T> for NoopConsumer { |
46 | 0 | fn split_off_left(&self) -> Self { |
47 | 0 | NoopConsumer |
48 | 0 | } |
49 | | |
50 | 0 | fn to_reducer(&self) -> NoopReducer { |
51 | 0 | NoopReducer |
52 | 0 | } |
53 | | } |
54 | | |
55 | | pub(super) struct NoopReducer; |
56 | | |
57 | | impl Reducer<()> for NoopReducer { |
58 | 0 | fn reduce(self, _left: (), _right: ()) {} |
59 | | } |