pub struct Arena { /* private fields */ }Expand description
Bump allocator for bulk array construction.
Allocates all column buffers from a single 64-byte aligned Vec64<u8>,
reducing per-batch allocation count from O(columns) to O(1).
See the module-level documentation for usage examples.
Implementations§
Source§impl Arena
impl Arena
Sourcepub fn with_capacity(bytes: usize) -> Self
pub fn with_capacity(bytes: usize) -> Self
Create an arena with the given byte capacity.
The backing buffer is allocated once as a single Vec64<u8>.
All subsequent push_* and reserve_* calls bump a cursor
within this allocation.
Sourcepub fn push_slice<T: Copy>(&mut self, data: &[T]) -> ArenaRegion
pub fn push_slice<T: Copy>(&mut self, data: &[T]) -> ArenaRegion
Copy a typed slice into the arena, returning a region handle.
The region is 64-byte aligned for SIMD compatibility.
§Panics
Panics if the arena does not have sufficient remaining capacity.
Sourcepub fn push_bitmask(&mut self, mask: &Bitmask) -> ArenaRegion
pub fn push_bitmask(&mut self, mask: &Bitmask) -> ArenaRegion
Copy a Bitmask’s raw bytes into the arena, returning a region handle.
The region is 64-byte aligned.
§Panics
Panics if the arena does not have sufficient remaining capacity.
Sourcepub fn reserve_slice<T>(&mut self, count: usize) -> ArenaRegion
pub fn reserve_slice<T>(&mut self, count: usize) -> ArenaRegion
Reserve uninitialised space for count elements of type T.
The region is 64-byte aligned. Use region_as_mut_slice() to
write data into the reserved region before freezing.
§Panics
Panics if the arena does not have sufficient remaining capacity.
Sourcepub fn region_as_mut_slice<T>(&mut self, region: &ArenaRegion) -> &mut [T]
pub fn region_as_mut_slice<T>(&mut self, region: &ArenaRegion) -> &mut [T]
Get a mutable typed slice for a previously reserved region.
Use this to write data into a region obtained from reserve_slice()
before calling freeze().
§Panics
Panics if the region is out of bounds or its byte length is not a
multiple of size_of::<T>().
Sourcepub fn write_slices<T: Copy>(
&mut self,
slices: &[(&[T], Option<&Bitmask>)],
total_count: usize,
has_nulls: bool,
) -> AAMaker
pub fn write_slices<T: Copy>( &mut self, slices: &[(&[T], Option<&Bitmask>)], total_count: usize, has_nulls: bool, ) -> AAMaker
Write multiple typed slices into a single contiguous region.
Reserves space for total_count elements, then copies each slice
sequentially into the region.
Optionally builds a null mask from per-slice masks. When has_nulls
is true, a mask region is reserved and populated from the provided
masks. Slices without a mask contribute all-valid bits.
Sourcepub fn write_string_slices<T>(
&mut self,
slices: &[(&[T], &[u8], Option<&Bitmask>)],
total_rows: usize,
total_data_bytes: usize,
has_nulls: bool,
) -> AAMaker
pub fn write_string_slices<T>( &mut self, slices: &[(&[T], &[u8], Option<&Bitmask>)], total_rows: usize, total_data_bytes: usize, has_nulls: bool, ) -> AAMaker
Write multiple string arrays into a single contiguous region.
Each entry is (offsets, data_bytes, null_mask) from one batch.
Handles offset adjustment so the combined offsets reference the
concatenated data buffer.
Sourcepub fn write_boolean_slices(
&mut self,
slices: &[(&Bitmask, Option<&Bitmask>)],
total_rows: usize,
has_nulls: bool,
) -> AAMaker
pub fn write_boolean_slices( &mut self, slices: &[(&Bitmask, Option<&Bitmask>)], total_rows: usize, has_nulls: bool, ) -> AAMaker
Write multiple bitmasks into a single contiguous boolean region.
Each entry is (data_bitmask, null_mask) from one batch.
Sourcepub fn capacity_for_regions(entries: &[(usize, usize)]) -> usize
pub fn capacity_for_regions(entries: &[(usize, usize)]) -> usize
Calculate total arena bytes needed for a set of regions.
Each entry is (len, element_size_in_bytes). Each region is
rounded up to 64-byte alignment, matching reserve_slice padding.
Sourcepub fn freeze(self) -> SharedBuffer
pub fn freeze(self) -> SharedBuffer
Freeze the arena, returning the backing SharedBuffer.
The arena is consumed and can no longer be written to.
Use ArenaRegion::to_buffer() and ArenaRegion::to_bitmask() to
extract typed views from the returned SharedBuffer.
Auto Trait Implementations§
impl Freeze for Arena
impl RefUnwindSafe for Arena
impl Send for Arena
impl Sync for Arena
impl Unpin for Arena
impl UnsafeUnpin for Arena
impl UnwindSafe for Arena
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more