odbc_api::buffers

Trait ColumnBuffer

Source
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) -> Option<Indicator>;
}
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 actual amount of valid num_rows filled by 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) -> Option<Indicator>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

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

Source§

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) -> Option<Indicator>

Implementors§

Source§

impl ColumnBuffer for AnyBuffer

Source§

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

Source§

impl<C: 'static> ColumnBuffer for TextColumn<C>

Source§

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

Source§

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

Source§

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