Function dfir_rs::util::iter_batches_stream
source ยท pub fn iter_batches_stream<I>(
iter: I,
n: usize,
) -> PollFn<impl FnMut(&mut Context<'_>) -> Poll<Option<I::Item>>>where
I: IntoIterator + Unpin,
Expand description
Converts an iterator into a stream that emits n
items at a time, yielding between each batch.
This is useful for breaking up a large iterator across several ticks: source_iter(...)
always
releases all items in the first tick. However using iter_batches_stream
with source_stream(...)
will cause n
items to be released each tick. (Although more than that may be emitted if there
are loops in the stratum).