pub struct NullableSliceMut<'a, T> { /* private fields */ }
Expand description

Used to fill a column buffer with an iterator. Returned by super::ColumnarBuffer::column_mut as part of an crate::buffers::AnyColumnViewMut.

Implementations

true if the slice has a length of 0.

Number of entries in this slice of the buffer

Write access to the underlying raw value and indicator buffer.

The number of elements in the buffer is equal to len.

This method is useful for writing performant bindings to datastructures with similar binary layout, as it allows for using memcopy rather than iterating over individual values.

Example
use odbc_api::{buffers::NullableSliceMut, sys::NULL_DATA};

// Memcopy the values into the buffer, and set indicators according to mask
// values.
fn copy_values_and_make_mask(
    new_values: &[i32],
    mask: &[bool],
    odbc_slice: &mut NullableSliceMut<i32>)
{
    let (values, indicators) = odbc_slice.raw_values();
    values.copy_from_slice(new_values);
    // Create array of bools indicating null values.
    indicators.iter_mut().zip(mask.iter()).for_each(|(indicator, &mask)| {
        *indicator = if mask {
            0
        } else {
            NULL_DATA
        }
    });
}

Writes the elements returned by the iterator into the buffer, starting at the beginning. Writes elements until the iterator returns None or the buffer can not hold more elements.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.