Skip to main content

Slice

Trait Slice 

Source
pub unsafe trait Slice {
    type Slice<'a>
       where Self: 'a;

    // Required method
    fn slice(&self, valid_rows: usize) -> Self::Slice<'_>;
}
Expand description

Access a safe view of the column buffer.

After a fetch operation buffers may only partially be filled with data, the rest of the buffer may contain uninitialized values. Also we must not permit any operation which would invalidate the addresses of the buffer. To make reading buffer contents after a fetch safe, ColumnBuffers implement this trait to offer safe views.

§Safety

Views must not allow access to uninitialized / invalid rows.

Required Associated Types§

Source

type Slice<'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 slice(&self, valid_rows: usize) -> Self::Slice<'_>

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.

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 Slice for Box<dyn AnyColumnBuffer>

Source§

type Slice<'a> = AnyColumnBufferSlice<'a>

Source§

fn slice(&self, valid_rows: usize) -> AnyColumnBufferSlice<'_>

Source§

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

Source§

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

Source§

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

Implementors§

Source§

impl Slice for AnyBuffer

Source§

type Slice<'a> = AnySlice<'a>

Source§

impl Slice for BinColumn

Source§

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

Source§

type Slice<'a> = TextColumnSlice<'a, C>

Source§

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

Source§

type Slice<'a> = <T as Slice>::Slice<'a> where T: 'a