| 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 | fn split_at(self, _index: usize) -> (Self, Self, NoopReducer) { |
| 11 | (NoopConsumer, NoopConsumer, NoopReducer) |
| 12 | } |
| 13 | |
| 14 | fn into_folder(self) -> Self { |
| 15 | self |
| 16 | } |
| 17 | |
| 18 | fn full(&self) -> bool { |
| 19 | false |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | impl<T> Folder<T> for NoopConsumer { |
| 24 | type Result = (); |
| 25 | |
| 26 | fn consume(self, _item: T) -> Self { |
| 27 | self |
| 28 | } |
| 29 | |
| 30 | fn consume_iter<I>(self, iter: I) -> Self |
| 31 | where |
| 32 | I: IntoIterator<Item = T>, |
| 33 | { |
| 34 | iter.into_iter().for_each(drop); |
| 35 | self |
| 36 | } |
| 37 | |
| 38 | fn complete(self) {} |
| 39 | |
| 40 | fn full(&self) -> bool { |
| 41 | false |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | impl<T> UnindexedConsumer<T> for NoopConsumer { |
| 46 | fn split_off_left(&self) -> Self { |
| 47 | NoopConsumer |
| 48 | } |
| 49 | |
| 50 | fn to_reducer(&self) -> NoopReducer { |
| 51 | NoopReducer |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | pub(super) struct NoopReducer; |
| 56 | |
| 57 | impl Reducer<()> for NoopReducer { |
| 58 | fn reduce(self, _left: (), _right: ()) {} |
| 59 | } |
| 60 | |