pub struct OwnedVector { /* private fields */ }Expand description
An owned standalone duckdb_vector (destroyed once on drop).
Implementations§
Source§impl OwnedVector
impl OwnedVector
Sourcepub fn new(ty: &LogicalType, capacity: u64) -> Option<OwnedVector>
pub fn new(ty: &LogicalType, capacity: u64) -> Option<OwnedVector>
Creates a flat vector of logical type ty with room for capacity rows.
§Errors
Returns None if DuckDB fails to allocate the vector.
Sourcepub fn column_type(&self) -> Option<LogicalType>
pub fn column_type(&self) -> Option<LogicalType>
The vector’s column (logical) type.
Sourcepub fn list_size(&self) -> u64
pub fn list_size(&self) -> u64
The number of elements in a LIST vector’s child (flattened) buffer.
Meaningful only for a LIST vector.
Sourcepub fn list_set_size(&mut self, size: u64) -> Result<()>
pub fn list_set_size(&mut self, size: u64) -> Result<()>
Sets the size of a LIST vector’s child buffer.
This does not reserve capacity (use list_reserve
first); a size may exceed capacity, so callers must reserve before writing.
§Errors
Returns an error if DuckDB rejects the call (e.g. a null/non-list vector).
Sourcepub fn list_reserve(&mut self, required_capacity: u64) -> Result<()>
pub fn list_reserve(&mut self, required_capacity: u64) -> Result<()>
Reserves capacity for required_capacity elements in a LIST vector’s child
buffer.
§Errors
Returns an error if DuckDB rejects the call (e.g. a null/non-list vector).
Sourcepub fn set_row_validity(&mut self, row: u64, valid: bool)
pub fn set_row_validity(&mut self, row: u64, valid: bool)
Sets whether the value at row is valid (true) or NULL (false),
ensuring the validity mask is writable first.
Sourcepub fn set_row_valid(&mut self, row: u64)
pub fn set_row_valid(&mut self, row: u64)
Marks the value at row valid (the inverse of setting it NULL), ensuring
the validity mask is writable first.
Sourcepub fn slice(&mut self, sel: &SelectionVector, len: u64) -> Result<()>
pub fn slice(&mut self, sel: &SelectionVector, len: u64) -> Result<()>
Destructively re-orders this vector in place so its first len logical rows
are sel’s selected rows (duckdb_slice_vector).
§Errors
Returns an error if len exceeds sel’s length.
Sourcepub fn copy_sel_into(
&self,
dst: &mut OwnedVector,
sel: &SelectionVector,
src_count: u64,
src_offset: u64,
dst_offset: u64,
) -> Result<()>
pub fn copy_sel_into( &self, dst: &mut OwnedVector, sel: &SelectionVector, src_count: u64, src_offset: u64, dst_offset: u64, ) -> Result<()>
Copies src_count rows from self (starting at src_offset) into dst
(starting at dst_offset), picking rows through sel
(duckdb_vector_copy_sel).
§Errors
Returns an error if sel holds fewer than src_count indices.
Sourcepub unsafe fn reference_value(&mut self, value: &OwnedValue)
pub unsafe fn reference_value(&mut self, value: &OwnedValue)
Makes this vector a constant vector that references value
(duckdb_vector_reference_value): every logical row reads as value,
sharing its storage rather than copying it.
§Safety
This creates a zero-copy alias: value must outlive every use of this vector,
and value must not be mutated or destroyed while the vector still references
it. The wrapper cannot encode that lifetime for two independently-owned
handles, so the invariant is the caller’s to uphold.
Sourcepub unsafe fn reference_vector(&mut self, from: &OwnedVector)
pub unsafe fn reference_vector(&mut self, from: &OwnedVector)
Makes this vector a zero-copy, read-only alias of from’s storage
(duckdb_vector_reference_vector).
§Safety
from must outlive every use of this vector, and neither vector’s shared
storage may be mutated while the alias is live (no overlapping mutable views).
The wrapper cannot encode that across two independently-owned vectors, so the
invariant is the caller’s to uphold.