Struct arrow_buffer::builder::BooleanBufferBuilder
source · pub struct BooleanBufferBuilder { /* private fields */ }
Expand description
Builder for BooleanBuffer
Implementations§
source§impl BooleanBufferBuilder
impl BooleanBufferBuilder
sourcepub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
pub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
Creates a new BooleanBufferBuilder
from MutableBuffer
of len
sourcepub fn truncate(&mut self, len: usize)
pub fn truncate(&mut self, len: usize)
Truncates the builder to the given length
If len
is greater than the buffer’s current length, this has no effect
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve space to at least additional
new bits.
Capacity will be >= self.len() + additional
.
New bytes are uninitialized and reading them is undefined behavior.
sourcepub fn resize(&mut self, len: usize)
pub fn resize(&mut self, len: usize)
Resizes the buffer, either truncating its contents (with no change in capacity), or
growing it (potentially reallocating it) and writing false
in the newly available bits.
sourcepub fn append_n(&mut self, additional: usize, v: bool)
pub fn append_n(&mut self, additional: usize, v: bool)
Appends n additional
bits of value v
into the buffer
sourcepub fn append_slice(&mut self, slice: &[bool])
pub fn append_slice(&mut self, slice: &[bool])
Appends a slice of booleans into the buffer
sourcepub fn append_packed_range(&mut self, range: Range<usize>, to_set: &[u8])
pub fn append_packed_range(&mut self, range: Range<usize>, to_set: &[u8])
Append range
bits from to_set
to_set
is a slice of bits packed LSB-first into [u8]
Panics
Panics if to_set
does not contain ceil(range.end / 8)
bytes
sourcepub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
Returns the packed bits
sourcepub fn finish(&mut self) -> BooleanBuffer
pub fn finish(&mut self) -> BooleanBuffer
Creates a BooleanBuffer
sourcepub fn finish_cloned(&self) -> BooleanBuffer
pub fn finish_cloned(&self) -> BooleanBuffer
Builds the BooleanBuffer without resetting the builder.