Make BooleanBufferBuilder get_bit not require mutable reference (#784)
diff --git a/arrow/src/array/builder.rs b/arrow/src/array/builder.rs
index 8139b79..50a9319 100644
--- a/arrow/src/array/builder.rs
+++ b/arrow/src/array/builder.rs
@@ -329,7 +329,7 @@
}
#[inline]
- pub fn get_bit(&mut self, index: usize) -> bool {
+ pub fn get_bit(&self, index: usize) -> bool {
bit_util::get_bit(self.buffer.as_slice(), index)
}
@@ -2709,6 +2709,17 @@
}
#[test]
+ fn test_bool_buffer_builder_get_first_bit_not_requires_mutability() {
+ let buffer = {
+ let mut buffer = BooleanBufferBuilder::new(16);
+ buffer.append_n(8, true);
+ buffer
+ };
+
+ assert!(buffer.get_bit(0));
+ }
+
+ #[test]
fn test_bool_buffer_builder_get_last_bit() {
let mut buffer = BooleanBufferBuilder::new(16);
buffer.append_n(8, true);