futures-rs icon indicating copy to clipboard operation
futures-rs copied to clipboard

Generalize chunks/ready_chunks/try_chunks/etc to collect into T: Extend, not just Vec

Open khuey opened this issue 2 years ago • 4 comments

In particular I would find it really useful to be able to ready_chunks a Stream of Futures into FuturesOrdereds and spawn them on a threadpool to parallelize my computation.

This would be a breaking change of course.

khuey avatar Aug 30 '21 15:08 khuey

Seems reasonable to me.

taiki-e avatar Aug 31 '21 01:08 taiki-e

This is actually a bit harder than I thought. Ideally there would be traits for with_capacity and len too so that we can reserve space in the collection and not have to track the collection's size again ourselves in Chunks.

khuey avatar Sep 04 '21 16:09 khuey

There is extend_reserve on nightly.

ibraheemdev avatar Sep 04 '21 16:09 ibraheemdev

Yeah people don't seem eager to stabilize it though, and there's nothing at all for len.

khuey avatar Sep 04 '21 16:09 khuey