pub enum BufferDesc {
Show 14 variants
Binary {
length: usize,
},
Text {
max_str_len: usize,
},
WText {
max_str_len: usize,
},
F64 {
nullable: bool,
},
F32 {
nullable: bool,
},
Date {
nullable: bool,
},
Time {
nullable: bool,
},
Timestamp {
nullable: bool,
},
I8 {
nullable: bool,
},
I16 {
nullable: bool,
},
I32 {
nullable: bool,
},
I64 {
nullable: bool,
},
U8 {
nullable: bool,
},
Bit {
nullable: bool,
},
}
Expand description
Describes a column of a crate::buffers::ColumnarBuffer
.
While related to to the crate::DataType
of the column this is bound to, the Buffer type is
different as it does not describe the type of the data source but the format the data is going
to be represented in memory. While the data source is often considered to choose the buffer type
the kind of processing which is supposed to be applied to the data may be even more important
if choosing the a buffer for the cursor type. E.g. if you intend to print a date to standard out
it may be more reasonable to bind it as Text
rather than Date
.
Variants§
Binary
Variable sized binary buffer, holding up to length
bytes per value.
Text
Text buffer holding strings with binary length of up to max_str_len
.
Consider an upper bound choosing this based on the information in a DataType::Varchar
column. E.g. PostgreSQL may return a field size of several GiB for individual values if a
column is specified as TEXT
, or Microsoft SQL Server may return 0
for a column of type
VARCHAR(max)
. In such situations, if values are truly that large, bulk fetching data is
not recommended, but streaming individual fields one by one. Usually though, the actual
cells of the table in the database contain much shorter values. The best thing todo is to
adapt the database schema to better reflect the actual size of the values. Lacking control
over the database schema, you can always choose a smaller buffer size than initializing the
buffer in disagreement with the database schema.
Fields
WText
UTF-16 encoded text buffer holding strings with length of up to max_str_len
. Length is in
terms of 2-Byte characters.
Fields
F64
64 bit floating point
Fields
F32
32 bit floating point
Fields
Date
Describes a buffer holding crate::sys::Date
values.
Fields
Time
Describes a buffer holding crate::sys::Time
values.
Fields
Timestamp
Describes a buffer holding crate::sys::Timestamp
values.
Fields
I8
Signed 8 Bit integer
Fields
I16
Signed 16 Bit integer
Fields
I32
Signed 32 Bit integer
Fields
I64
Signed 64 Bit integer
Fields
U8
Unsigned 8 Bit integer
Fields
Bit
Can either be zero or one
Implementations§
Source§impl BufferDesc
impl BufferDesc
pub fn from_data_type(data_type: DataType, nullable: bool) -> Option<Self>
Sourcepub fn bytes_per_row(&self) -> usize
pub fn bytes_per_row(&self) -> usize
Element size of buffer if bound as a columnar row. Can be used to estimate memory for columnar bindings.
Trait Implementations§
Source§impl Clone for BufferDesc
impl Clone for BufferDesc
Source§fn clone(&self) -> BufferDesc
fn clone(&self) -> BufferDesc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BufferDesc
impl Debug for BufferDesc
Source§impl PartialEq for BufferDesc
impl PartialEq for BufferDesc
impl Copy for BufferDesc
impl Eq for BufferDesc
impl StructuralPartialEq for BufferDesc
Auto Trait Implementations§
impl Freeze for BufferDesc
impl RefUnwindSafe for BufferDesc
impl Send for BufferDesc
impl Sync for BufferDesc
impl Unpin for BufferDesc
impl UnwindSafe for BufferDesc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)