rluvaton commented on code in PR #8696:
URL: https://github.com/apache/arrow-rs/pull/8696#discussion_r2463730850


##########
arrow-buffer/src/util/bit_iterator.rs:
##########
@@ -486,4 +579,426 @@ mod tests {
             .collect();
         assert_eq!(result, expected);
     }
+
+    trait SharedBetweenBitIteratorAndSliceIter:
+        ExactSizeIterator<Item = bool> + DoubleEndedIterator<Item = bool>
+    {
+    }
+    impl<T: ?Sized + ExactSizeIterator<Item = bool> + DoubleEndedIterator<Item 
= bool>>
+        SharedBetweenBitIteratorAndSliceIter for T
+    {
+    }
+
+    fn mutate_2_iters<T: SharedBetweenBitIteratorAndSliceIter>(
+        mut bit_iterator: BitIterator,
+        mut source: T,
+        mutate_fn: impl Fn(&mut dyn SharedBetweenBitIteratorAndSliceIter),
+    ) -> (BitIterator, T) {
+        mutate_fn(&mut bit_iterator);
+        mutate_fn(&mut source);
+
+        (bit_iterator, source)
+    }
+
+    fn get_bit_iterator_cases() -> impl Iterator<Item = (BooleanBuffer, 
Vec<bool>)> {
+        let mut rng = StdRng::seed_from_u64(42);
+
+        [0, 1, 6, 8, 100, 164]
+            .map(|len| {
+                let source = (0..len).map(|_| 
rng.random_bool(0.5)).collect::<Vec<_>>();
+
+                (BooleanBuffer::from(source.as_slice()), source)
+            })
+            .into_iter()
+    }
+
+    fn setup_and_assert(

Review Comment:
   In order for the generic to be removed we need to have 2 functions, 1 for 
`BitIterator` and 1 for `Vec<bool>`, I did not want to have 2 functions to 
avoid possible bugs in the tests where the setup is different.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to