pub unsafe trait ColumnBuffer: CDataMut {
    type View<'a>
       where Self: 'a;

    // Required methods
    fn view(&self, valid_rows: usize) -> Self::View<'_>;
    fn fill_default(&mut self, from: usize, to: usize);
    fn capacity(&self) -> usize;
    fn has_truncated_values(&self, num_rows: usize) -> bool;
}
Expand description

A buffer for a single column intended to be used together with ColumnarBuffer.

Safety

Views must not allow access to unintialized / invalid rows.

Required Associated Types§

source

type View<'a> where Self: 'a

Immutable view on the column data. Used in safe abstractions. User must not be able to access uninitialized or invalid memory of the buffer through this interface.

Required Methods§

source

fn view(&self, valid_rows: usize) -> Self::View<'_>

Num rows may not exceed the actually amount of valid num_rows filled be the ODBC API. The column buffer does not know how many elements were in the last row group, and therefore can not guarantee the accessed element to be valid and in a defined state. It also can not panic on accessing an undefined element.

source

fn fill_default(&mut self, from: usize, to: usize)

Fills the column with the default representation of values, between from and to index.

source

fn capacity(&self) -> usize

Current capacity of the column

source

fn has_truncated_values(&self, num_rows: usize) -> bool

true if any value is truncated in the range [0, num_rows).

After fetching data we may want to know if any value has been truncated due to the buffer not being able to hold elements of that size. This method checks the indicator buffer element wise.

Implementations on Foreign Types§

source§

impl<T> ColumnBuffer for Vec<T>where T: Pod,

§

type View<'a> = &'a [T]

source§

fn view(&self, valid_rows: usize) -> &[T]

source§

fn fill_default(&mut self, from: usize, to: usize)

source§

fn capacity(&self) -> usize

source§

fn has_truncated_values(&self, _num_rows: usize) -> bool

Implementors§

source§

impl ColumnBuffer for AnyBuffer

§

type View<'a> = AnySlice<'a>

source§

impl<C: 'static> ColumnBuffer for TextColumn<C>where TextColumn<C>: CDataMut + HasDataType,

§

type View<'a> = TextColumnView<'a, C>

source§

impl<T> ColumnBuffer for WithDataType<T>where T: ColumnBuffer,

§

type View<'a> where T: 'a = <T as ColumnBuffer>::View<'a>