Struct odbc_api::buffers::TextColumnView
source · [−]pub struct TextColumnView<'c, C> { /* private fields */ }
Expand description
Allows read only access to the valid part of a text column.
You may ask, why is this type required, should we not just be able to use &TextColumn
? The
problem with TextColumn
is, that it is a buffer, but it has no idea how many of its members
are actually valid, and have been returned with the last row group of the the result set. That
number is maintained on the level of the entire column buffer. So a text column knows the number
of valid rows, in addition to holding a reference to the buffer, in order to guarantee, that
every element acccessed through it, is valid.
Implementations
sourceimpl<'c, C> TextColumnView<'c, C>
impl<'c, C> TextColumnView<'c, C>
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True if, and only if there are no valid rows in the column buffer.
sourcepub fn get(&self, index: usize) -> Option<&'c [C]>
pub fn get(&self, index: usize) -> Option<&'c [C]>
Slice of text at the specified row index without terminating zero.
sourcepub fn iter(&self) -> TextColumnIt<'c, C>ⓘNotable traits for TextColumnIt<'c, u8>impl<'c> Iterator for TextColumnIt<'c, u8> type Item = Option<&'c [u8]>;impl<'c> Iterator for TextColumnIt<'c, u16> type Item = Option<&'c U16Str>;
pub fn iter(&self) -> TextColumnIt<'c, C>ⓘNotable traits for TextColumnIt<'c, u8>impl<'c> Iterator for TextColumnIt<'c, u8> type Item = Option<&'c [u8]>;impl<'c> Iterator for TextColumnIt<'c, u16> type Item = Option<&'c U16Str>;
Iterator over the valid elements of the text buffer
sourcepub fn content_length_at(&self, row_index: usize) -> Option<usize>
pub fn content_length_at(&self, row_index: usize) -> Option<usize>
Length of value at the specified position. This is different from an indicator as it refers to the length of the value in the buffer, not to the length of the value in the datasource. The two things are different for truncated values.
sourcepub fn raw_value_buffer(&self) -> &'c [C]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn raw_value_buffer(&self) -> &'c [C]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Provides access to the raw underlying value buffer. Normal applications should have little reason to call this method. Yet it may be useful for writing bindings which copy directly from the ODBC in memory representation into other kinds of buffers.
The buffer contains the bytes for every non null valid element, padded to the maximum string
length. The content of the padding bytes is undefined. Usually ODBC drivers write a
terminating zero at the end of each string. For the actual value length call
[Self::conten_length_at
]. Any element starts at index * (Self::max_len
+ 1).
pub fn max_len(&self) -> usize
Trait Implementations
sourceimpl<'c, C: Clone> Clone for TextColumnView<'c, C>
impl<'c, C: Clone> Clone for TextColumnView<'c, C>
sourcefn clone(&self) -> TextColumnView<'c, C>
fn clone(&self) -> TextColumnView<'c, C>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'c, C: Debug> Debug for TextColumnView<'c, C>
impl<'c, C: Debug> Debug for TextColumnView<'c, C>
impl<'c, C: Copy> Copy for TextColumnView<'c, C>
Auto Trait Implementations
impl<'c, C> RefUnwindSafe for TextColumnView<'c, C> where
C: RefUnwindSafe,
impl<'c, C> Send for TextColumnView<'c, C> where
C: Sync,
impl<'c, C> Sync for TextColumnView<'c, C> where
C: Sync,
impl<'c, C> Unpin for TextColumnView<'c, C>
impl<'c, C> UnwindSafe for TextColumnView<'c, C> where
C: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more