This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 615d783 Make BooleanBufferBuilder get_bit not require mutable
reference (#784)
615d783 is described below
commit 615d7830fdaf994ebd32ca1e349daf68b18c99b0
Author: Boaz <[email protected]>
AuthorDate: Sun Sep 19 18:05:39 2021 +0300
Make BooleanBufferBuilder get_bit not require mutable reference (#784)
---
arrow/src/array/builder.rs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
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 @@ impl BooleanBufferBuilder {
}
#[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 @@ mod tests {
}
#[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);