pub struct RowBatch { /* private fields */ }Expand description
A reusable buffer of formatted SQL row tuples, joined by ,\n.
Implementations§
Source§impl RowBatch
impl RowBatch
Sourcepub fn with_capacity(batch_size: usize, estimated_bytes: usize) -> Self
pub fn with_capacity(batch_size: usize, estimated_bytes: usize) -> Self
Create an empty batch sized for roughly batch_size rows, reserving
up to estimated_bytes for the initial buffer. The reservation is
capped at batch_size * MAX_BYTES_PER_ROW_HINT so a caller-supplied
estimate can’t force an outsized single allocation; the buffer still
grows normally afterwards if rows exceed the estimate.
Sourcepub fn push_fmt(&mut self, args: Arguments<'_>) -> Result
pub fn push_fmt(&mut self, args: Arguments<'_>) -> Result
Append a formatted row, prefixing it with ,\n unless it is the
first row in the batch.
Writing to a String is infallible, but the signature mirrors
std::fmt::Write::write_fmt so callers can propagate the error with
? rather than reach for unwrap.
Sourcepub fn row_count(&self) -> usize
pub fn row_count(&self) -> usize
How many rows have been pushed since the last RowBatch::clear.
Auto Trait Implementations§
impl Freeze for RowBatch
impl RefUnwindSafe for RowBatch
impl Send for RowBatch
impl Sync for RowBatch
impl Unpin for RowBatch
impl UnsafeUnpin for RowBatch
impl UnwindSafe for RowBatch
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more