Struct arrow_buffer::builder::NullBufferBuilder
source · pub struct NullBufferBuilder { /* private fields */ }
Expand description
Builder for creating the null bit buffer.
This builder only materializes the buffer when we append false
.
If you only append true
s to the builder, what you get will be
None
when calling finish
.
This optimization is very important for the performance.
Implementations§
source§impl NullBufferBuilder
impl NullBufferBuilder
sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a new empty builder.
capacity
is the number of bits in the null buffer.
sourcepub fn new_with_len(len: usize) -> Self
pub fn new_with_len(len: usize) -> Self
Creates a new builder with given length.
sourcepub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
pub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
Creates a new builder from a MutableBuffer
.
sourcepub fn append_n_non_nulls(&mut self, n: usize)
pub fn append_n_non_nulls(&mut self, n: usize)
Appends n
true
s into the builder
to indicate that these n
items are not nulls.
sourcepub fn append_non_null(&mut self)
pub fn append_non_null(&mut self)
Appends a true
into the builder
to indicate that this item is not null.
sourcepub fn append_n_nulls(&mut self, n: usize)
pub fn append_n_nulls(&mut self, n: usize)
Appends n
false
s into the builder
to indicate that these n
items are nulls.
sourcepub fn append_null(&mut self)
pub fn append_null(&mut self)
Appends a false
into the builder
to indicate that this item is null.
sourcepub fn append_slice(&mut self, slice: &[bool])
pub fn append_slice(&mut self, slice: &[bool])
Appends a boolean slice into the builder to indicate the validations of these items.
sourcepub fn finish(&mut self) -> Option<NullBuffer>
pub fn finish(&mut self) -> Option<NullBuffer>
Builds the null buffer and resets the builder.
Returns None
if the builder only contains true
s.
sourcepub fn finish_cloned(&self) -> Option<NullBuffer>
pub fn finish_cloned(&self) -> Option<NullBuffer>
Builds the NullBuffer without resetting the builder.