Skip to main content

batch

Function batch 

Source
pub fn batch<S, T>(
    stream: S,
    size: usize,
    timeout: Duration,
) -> impl Stream<Item = Vec<T>> + Send + 'static
where S: Stream<Item = T> + Send + 'static, T: Send + 'static,
Expand description

Collect up to size items into a batch.

A batch is emitted either when size items arrive or when timeout elapses since the first item in the batch.