Trait odbc_api::buffers::ColumnBuffer
source · [−]pub unsafe trait ColumnBuffer: for<'a> ColumnProjections<'a> + CDataMut {
unsafe fn view(
&self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::View;
unsafe fn view_mut(
&mut self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::ViewMut;
fn fill_default(&mut self, from: usize, to: usize);
fn capacity(&self) -> usize;
}Expand description
A buffer able to be used together with ColumnarBuffer.
Safety
Views must not allow access to unintialized / invalid rows.
Required methods
unsafe fn view(
&self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::View
unsafe fn view(
&self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::View
Safety
Underlying buffer may not know how many elements have been written to it by the last ODBC
function call. So we tell it how many, and get a save to use view in Return. Specifying an
erroneous value for valid_rows, may therfore result in the construced view giving us
access to invalid rows in a safe abstraction, which of course would be a Bug.
unsafe fn view_mut(
&mut self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::ViewMut
unsafe fn view_mut(
&mut self,
valid_rows: usize
) -> <Self as ColumnProjections<'_>>::ViewMut
Safety
valid_rows must be valid, otherwise the safe abstraction would provide access to invalid
memory.
fn fill_default(&mut self, from: usize, to: usize)
fn fill_default(&mut self, from: usize, to: usize)
Fills the column with the default representation of values, between from and to index.