Currently the response body is a Read, but this makes it very difficult to stream bodies from non-Read sources (e.g. from a database query) as you need to write a state machine to fill the buffer. If the response body is a function that takes a Write, then this will be very easy as you can just call write repeatedly from within the function.
The function could be called by Rouille with the stream directly, or with a wrapper that adds chunked encoding metadata.
Currently the response body is a Read, but this makes it very difficult to stream bodies from non-Read sources (e.g. from a database query) as you need to write a state machine to fill the buffer. If the response body is a function that takes a Write, then this will be very easy as you can just call write repeatedly from within the function.
The function could be called by Rouille with the stream directly, or with a wrapper that adds chunked encoding metadata.
Something along these lines: