Skip to main content

FlatVector

Struct FlatVector 

Source
pub struct FlatVector<'a> { /* private fields */ }
Expand description

A flat (contiguous, scalar-row) vector borrowed from a DataChunkHandle.

Implementations§

Source§

impl<'a> FlatVector<'a>

Source

pub fn capacity(&self) -> usize

Returns the capacity of the vector

Source

pub fn row_is_null(&self, row: u64) -> bool

Returns true if the row at the given index is null

§Panics

Panics if row is outside the vector capacity.

Source

pub fn try_row_is_null(&self, row: u64) -> Result<bool>

Returns whether the row is null, or an error if it is out of range.

Source

pub unsafe fn as_mut_ptr<T>(&self) -> *mut T

Returns a mutable pointer to the vector’s backing data cast to T.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage. Before dereferencing the pointer, the caller must also ensure the target element is initialized, in bounds, and not accessed through another incompatible or aliased reference.

Source

pub unsafe fn as_slice<T>(&self) -> &[T]

Returns a typed slice of the vector.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage, the backing allocation is sized for self.capacity() elements of T, each returned element is initialized before it is read, and no &mut references to the same storage exist for the returned lifetime.

Source

pub unsafe fn as_slice_with_len<T>(&self, len: usize) -> &[T]

Returns a typed slice of the vector up to a certain length.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage, the backing allocation is sized for at least len elements of T, each returned element is initialized before it is read, and no &mut references to the same storage exist for the returned lifetime.

Source

pub unsafe fn as_mut_slice<T>(&mut self) -> &mut [T]

Returns a typed mutable slice of the vector.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage, the backing allocation is sized for self.capacity() elements of T, and no other references to the same storage exist for the returned lifetime.

Source

pub unsafe fn as_mut_slice_with_len<T>(&mut self, len: usize) -> &mut [T]

Returns a typed mutable slice of the vector up to a certain length.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage, the backing allocation is sized for at least len elements of T, and no other references to the same storage exist for the returned lifetime.

Source

pub fn logical_type(&self) -> LogicalTypeHandle

Returns the logical type of the vector

Source

pub fn set_null(&mut self, row: usize)

Set row as null

Source

pub unsafe fn copy<T: Copy>(&mut self, data: &[T])

Copy typed data to the vector.

§Safety

The caller must ensure T matches the DuckDB vector’s physical storage and no other references to the same storage exist during the copy.

§Panics

Panics if data.len() exceeds the vector capacity.

Trait Implementations§

Source§

impl Inserter<&String> for FlatVector<'_>

Source§

fn insert(&self, index: usize, value: &String)

Insert a value into the vector.
Source§

impl Inserter<&Vec<u8>> for FlatVector<'_>

Source§

fn insert(&self, index: usize, value: &Vec<u8>)

Insert a value into the vector.
Source§

impl Inserter<&[u8]> for FlatVector<'_>

Source§

fn insert(&self, index: usize, value: &[u8])

Insert a value into the vector.
Source§

impl Inserter<&str> for FlatVector<'_>

Source§

fn insert(&self, index: usize, value: &str)

Insert a value into the vector.
Source§

impl Inserter<CString> for FlatVector<'_>

Source§

fn insert(&self, index: usize, value: CString)

Insert a value into the vector.

Auto Trait Implementations§

§

impl<'a> !Send for FlatVector<'a>

§

impl<'a> !Sync for FlatVector<'a>

§

impl<'a> Freeze for FlatVector<'a>

§

impl<'a> RefUnwindSafe for FlatVector<'a>

§

impl<'a> Unpin for FlatVector<'a>

§

impl<'a> UnsafeUnpin for FlatVector<'a>

§

impl<'a> UnwindSafe for FlatVector<'a>

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<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, 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.