Function hydroflow::util::iter_batches_stream
source · pub fn iter_batches_stream<I>(
iter: I,
n: usize
) -> PollFn<impl FnMut(&mut Context<'_>) -> Poll<Option<I::Item>>>
Expand description
Returns an [Stream
] that emits n
items at a time from iter
at a time, yielding in-between.
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).