Skip to main content

OwnedVector

Struct OwnedVector 

Source
pub struct OwnedVector { /* private fields */ }
Expand description

An owned standalone duckdb_vector (destroyed once on drop).

Implementations§

Source§

impl OwnedVector

Source

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.

Source

pub fn column_type(&self) -> Option<LogicalType>

The vector’s column (logical) type.

Source

pub fn list_size(&self) -> u64

The number of elements in a LIST vector’s child (flattened) buffer.

Meaningful only for a LIST vector.

Source

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

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for OwnedVector

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.