hyperium / http-body

Asynchronous HTTP body trait
MIT License
129 stars 50 forks source link

Add BodyStream. #91

Closed nitsky closed 1 year ago

nitsky commented 1 year ago

This PR adds a BodyStream type to create a Stream from a Body. This is useful when you want to stream data from a Body to code that accepts a Stream.

mzr commented 1 year ago

+1 on this. Very useful to integrate with Gotham that requires hyper::body::Body in a response. In order to get that from impl http_body::Body, a call to hyper::body::Body::wrap_stream(s: Stream) is required. A compatibility that converts impl http_body::Body to a T: Stream seems very useful!