Skip to main content

Arena

Struct Arena 

Source
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

Source

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.

Source

pub fn used(&self) -> usize

Number of bytes used so far, including alignment padding.

Source

pub fn remaining(&self) -> usize

Remaining capacity in bytes.

Source

pub fn capacity(&self) -> usize

Total capacity in bytes.

Source

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.

Source

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.

Source

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.

Source

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>().

Source

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.

Source

pub fn write_string_slices<T>( &mut self, slices: &[(&[T], &[u8], Option<&Bitmask>)], total_rows: usize, total_data_bytes: usize, has_nulls: bool, ) -> AAMaker
where T: Copy + Default + Add<Output = T> + Sub<Output = T> + ToPrimitive + NumCast,

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.

Source

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.

Source

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.

Source

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§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PlanCallbackArgs for T

Source§

impl<T> PlanCallbackOut for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more