seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.96k stars 1.13k forks source link

Make `Response::bytes_stream` return a concrete type #2429

Closed its-the-shrimp closed 1 month ago

its-the-shrimp commented 2 months ago

in my project I needed to store the resulting stream to avoid an allocation, but the fact that the method returns an impl Stream means that it wasn't possible to do so without boxing it

seanmonstar commented 2 months ago

Thanks for the PR! But I'm not going to expose a named type for this method.

You can store it by boxing it, as one option. But you said you don't want to allocate. So you could also just store the Response, or put it in a newtype and pull out a chunk in a Stream impl.