Skip to main content

collect_batches

Function collect_batches 

Source
pub fn collect_batches<T, E>(
    next: impl FnMut() -> Result<Vec<T>, E>,
) -> Result<Vec<T>, E>
Expand description

Drive a batch-returning guest export to exhaustion, aggregating every batch into one owned Vec (§4.3). next wraps the guest’s next-batch-style call; an empty batch is the exhausted sentinel. The host owns this loop — the guest only ever returns data. A next that errors aborts the drive with that error (a trapped/fuel-exhausted batch call never yields a partial-but- silent result).