pub struct FixedSizeBinaryBuilder {
values_builder: UInt8BufferBuilder,
null_buffer_builder: NullBufferBuilder,
value_length: i32,
}
Expand description
Builder for FixedSizeBinaryArray
let mut builder = FixedSizeBinaryBuilder::with_capacity(3, 5);
// [b"hello", null, b"arrow"]
builder.append_value(b"hello").unwrap();
builder.append_null();
builder.append_value(b"arrow").unwrap();
let array = builder.finish();
assert_eq!(array.value(0), b"hello");
assert!(array.is_null(1));
assert_eq!(array.value(2), b"arrow");
Fields§
§values_builder: UInt8BufferBuilder
§null_buffer_builder: NullBufferBuilder
§value_length: i32
Implementations§
Source§impl FixedSizeBinaryBuilder
impl FixedSizeBinaryBuilder
Sourcepub fn new(byte_width: i32) -> Self
pub fn new(byte_width: i32) -> Self
Creates a new FixedSizeBinaryBuilder
Sourcepub fn with_capacity(capacity: usize, byte_width: i32) -> Self
pub fn with_capacity(capacity: usize, byte_width: i32) -> Self
Creates a new FixedSizeBinaryBuilder
, capacity
is the number of byte slices
that can be appended without reallocating
Sourcepub fn append_value(
&mut self,
value: impl AsRef<[u8]>,
) -> Result<(), ArrowError>
pub fn append_value( &mut self, value: impl AsRef<[u8]>, ) -> Result<(), ArrowError>
Appends a byte slice into the builder.
Automatically update the null buffer to delimit the slice appended in as a distinct value element.
Sourcepub fn append_null(&mut self)
pub fn append_null(&mut self)
Append a null value to the array.
Sourcepub fn finish(&mut self) -> FixedSizeBinaryArray
pub fn finish(&mut self) -> FixedSizeBinaryArray
Builds the FixedSizeBinaryArray
and reset this builder.
Sourcepub fn finish_cloned(&self) -> FixedSizeBinaryArray
pub fn finish_cloned(&self) -> FixedSizeBinaryArray
Builds the FixedSizeBinaryArray
without resetting the builder.
Sourcepub fn validity_slice(&self) -> Option<&[u8]>
pub fn validity_slice(&self) -> Option<&[u8]>
Returns the current null buffer as a slice
Trait Implementations§
Source§impl ArrayBuilder for FixedSizeBinaryBuilder
impl ArrayBuilder for FixedSizeBinaryBuilder
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns the builder as a mutable Any
reference.
Source§fn finish_cloned(&self) -> ArrayRef
fn finish_cloned(&self) -> ArrayRef
Builds the array without resetting the builder.
Auto Trait Implementations§
impl Freeze for FixedSizeBinaryBuilder
impl RefUnwindSafe for FixedSizeBinaryBuilder
impl Send for FixedSizeBinaryBuilder
impl Sync for FixedSizeBinaryBuilder
impl Unpin for FixedSizeBinaryBuilder
impl UnwindSafe for FixedSizeBinaryBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more