pub struct BatchConfig {
pub batch_size: NonZeroUsize,
pub string_capacity: usize,
pub binary_capacity: usize,
pub coerce_types: bool,
}Expand description
Configuration for batch processing.
Controls memory allocation and processing behavior for batch conversion.
Fields§
§batch_size: NonZeroUsizeMaximum number of rows per batch.
Uses NonZeroUsize to prevent division-by-zero and infinite loops.
Default: 65536 (64K rows).
string_capacity: usizeInitial capacity for string builders (bytes).
Pre-allocating string capacity reduces reallocations. Default: 1MB.
binary_capacity: usizeInitial capacity for binary builders (bytes).
Pre-allocating binary capacity reduces reallocations. Default: 1MB.
coerce_types: boolWhether to coerce types when possible.
When true, numeric types may be widened (e.g., INT to BIGINT) to avoid precision loss. Default: false.
Implementations§
Source§impl BatchConfig
impl BatchConfig
Sourcepub fn with_batch_size(batch_size: usize) -> Self
pub fn with_batch_size(batch_size: usize) -> Self
Create a new configuration with the specified batch size.
§Panics
Panics if batch_size is zero. Use try_with_batch_size for fallible construction.
Sourcepub fn try_with_batch_size(batch_size: usize) -> Option<Self>
pub fn try_with_batch_size(batch_size: usize) -> Option<Self>
Create a new configuration with the specified batch size.
Returns None if batch_size is zero.
Sourcepub const fn batch_size_usize(&self) -> usize
pub const fn batch_size_usize(&self) -> usize
Get batch size as usize for iteration.
Sourcepub const fn string_capacity(self, capacity: usize) -> Self
pub const fn string_capacity(self, capacity: usize) -> Self
Set the string builder capacity.
Sourcepub const fn binary_capacity(self, capacity: usize) -> Self
pub const fn binary_capacity(self, capacity: usize) -> Self
Set the binary builder capacity.
Sourcepub const fn coerce_types(self, coerce: bool) -> Self
pub const fn coerce_types(self, coerce: bool) -> Self
Enable or disable type coercion.
Trait Implementations§
Source§impl Clone for BatchConfig
impl Clone for BatchConfig
Source§fn clone(&self) -> BatchConfig
fn clone(&self) -> BatchConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more