Skip to main content

BakingScratch

Struct BakingScratch 

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

Caller-owned reusable scratch buffers for bake_rows_into_template.

The merge needs five intermediate buffers, all sized from the inputs of the current call. Constructing one BakingScratch and passing &mut to every bake reuses these allocations: each buffer is clear()-ed and re-grown at the start of a call without ever calling shrink_to_fit, so at steady state (once the largest seen template/batch has been processed) a bake allocates no temporaries.

The fields are private; the struct is an opaque buffer bag. The buffers are, in element type and per-call length:

  • cut_nz_per_col: Vec<u32> — length num_cols; per-column count of CSR contributions (count pass).
  • col_list_start: Vec<u32> — length num_cols + 1; prefix-sum column-offset table into the flat CSR-grouped buffers.
  • col_list_row: Vec<i32> — length rows_nnz; flat row-index buffer grouped by column.
  • col_list_val: Vec<f64> — length rows_nnz; flat value buffer grouped by column.
  • write_cursor: Vec<u32> — length num_cols; per-column write offset within the flat buffers.

Implementations§

Source§

impl BakingScratch

Source

pub fn new() -> Self

Construct an empty scratch. All buffers grow lazily on first bake.

Trait Implementations§

Source§

impl Debug for BakingScratch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BakingScratch

Source§

fn default() -> BakingScratch

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

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<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, 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.