pub struct SelectionVector { /* private fields */ }Expand description
RAII wrapper for a duckdb_selection_vector.
Owns size 32-bit row indices ([sel_t]), zero-initialised by
new. Automatically destroyed on drop.
Implementations§
Source§impl SelectionVector
impl SelectionVector
Sourcepub fn new(size: usize) -> Result<Self, ExtensionError>
pub fn new(size: usize) -> Result<Self, ExtensionError>
Allocates a selection vector holding size indices, all zero.
Fill the indices via as_mut_slice.
DuckDB leaves the buffer uninitialised in release builds, so this
zeroes it: every index starts as row 0, never as stale heap contents.
§Errors
Returns an error if size exceeds MAX_LEN — checked before DuckDB
is called, because above it DuckDB either miscomputes the allocation
size or throws — or if DuckDB returns a null handle or buffer.
An allocation within the limit that the system cannot satisfy still
makes DuckDB throw, which aborts the process, just as a failed Rust
allocation does.
Sourcepub fn as_mut_slice(&mut self) -> &mut [sel_t] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [sel_t] ⓘ
Returns the indices as a mutable slice for filling in.