This is an automated email from the ASF dual-hosted git repository.
tustvold 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 889a90436f impl `From<ScalarBuffer<T>>` for `Buffer` (#6389)
889a90436f is described below
commit 889a90436ffd69e94975049b047c413c53b2dfe3
Author: Matthijs Brobbel <[email protected]>
AuthorDate: Fri Sep 13 11:23:25 2024 +0200
impl `From<ScalarBuffer<T>>` for `Buffer` (#6389)
---
arrow-buffer/src/buffer/immutable.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arrow-buffer/src/buffer/immutable.rs
b/arrow-buffer/src/buffer/immutable.rs
index fef2f8008b..8d1a46583f 100644
--- a/arrow-buffer/src/buffer/immutable.rs
+++ b/arrow-buffer/src/buffer/immutable.rs
@@ -26,7 +26,7 @@ use crate::BufferBuilder;
use crate::{bytes::Bytes, native::ArrowNativeType};
use super::ops::bitwise_unary_op_helper;
-use super::MutableBuffer;
+use super::{MutableBuffer, ScalarBuffer};
/// Buffer represents a contiguous memory region that can be shared with other
buffers and across
/// thread boundaries.
@@ -391,6 +391,12 @@ impl<T: ArrowNativeType> From<Vec<T>> for Buffer {
}
}
+impl<T: ArrowNativeType> From<ScalarBuffer<T>> for Buffer {
+ fn from(value: ScalarBuffer<T>) -> Self {
+ value.into_inner()
+ }
+}
+
/// Creating a `Buffer` instance by storing the boolean values into the buffer
impl FromIterator<bool> for Buffer {
fn from_iter<I>(iter: I) -> Self