Skip to main content

RowBatch

Struct RowBatch 

Source
pub struct RowBatch { /* private fields */ }
Expand description

A reusable buffer of formatted SQL row tuples, joined by ,\n.

Implementations§

Source§

impl RowBatch

Source

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.

Source

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.

Source

pub fn as_str(&self) -> &str

The batch’s buffered rows, joined by ,\n.

Source

pub fn row_count(&self) -> usize

How many rows have been pushed since the last RowBatch::clear.

Source

pub fn is_empty(&self) -> bool

Whether any rows have been pushed since the last clear.

Source

pub fn capacity(&self) -> usize

The buffer’s current capacity in bytes.

Source

pub fn clear(&mut self)

Reset the batch to empty without shrinking its buffer, so the next batch reuses the same allocation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V