Skip to main content

assert_bounded_memory

Function assert_bounded_memory 

Source
pub async fn assert_bounded_memory<S: Source + ?Sized>(
    source: &S,
    batch_size: usize,
    total: usize,
)
Expand description

Check 2. Drive stream_pages over a source that yields total records and assert the consumer never holds more than ~batch_size records live at once (i.e. the source pages instead of buffering everything).

Requires batch_size > 0 and total > batch_size for a meaningful result. Asserts: every record is streamed (sum == total), the largest single page is <= batch_size, and strictly < total (proving the source did not emit the whole set as one page).