Skip to content

Commit

Permalink
impl From<ScalarBuffer<T>> for Buffer (#6389)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel authored Sep 13, 2024
1 parent f80bc5f commit 889a904
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 889a904

Please sign in to comment.