File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,9 @@ impl<T: ArrowNativeType> PartialEq<ScalarBuffer<T>> for Vec<T> {
221
221
}
222
222
}
223
223
224
+ /// If T implements Eq, then so does ScalarBuffer.
225
+ impl < T : ArrowNativeType + Eq > Eq for ScalarBuffer < T > { }
226
+
224
227
#[ cfg( test) ]
225
228
mod tests {
226
229
use std:: { ptr:: NonNull , sync:: Arc } ;
@@ -342,4 +345,19 @@ mod tests {
342
345
assert_eq ! ( vec, input. as_slice( ) ) ;
343
346
assert_ne ! ( vec. as_ptr( ) , input. as_ptr( ) ) ;
344
347
}
348
+
349
+ #[ test]
350
+ fn scalar_buffer_impl_eq ( ) {
351
+ fn are_equal < T : Eq > ( a : & T , b : & T ) -> bool {
352
+ a. eq ( b)
353
+ }
354
+
355
+ assert ! (
356
+ are_equal(
357
+ & ScalarBuffer :: <i16 >:: from( vec![ 23 ] ) ,
358
+ & ScalarBuffer :: <i16 >:: from( vec![ 23 ] )
359
+ ) ,
360
+ "ScalarBuffer should implement Eq if the inner type does"
361
+ ) ;
362
+ }
345
363
}
You can’t perform that action at this time.
0 commit comments