Open Dirbaio opened 3 years ago
I agree that this sense in the abstract, but I believe having a lifetime on Request would be a problem for tide, which needs static lifetimes on arguments to endpoints
We could maybe allow Body to have an Arc
'd reader, though. (If that doesn't already work.)
@yoshuawuyts I think this is also gated on the whole async closures thing.
Thinking about the complexity in async-h1 around cloning the readers, it occurred to me that most of it would go away if Request could have a borrowed body reader.
Arc<Mutex<xx>>
) so it can give one clone to the handler, and keep another to discard it if the handler doesn't read it. Giving a borrow to the handler avoids having to clone: once the handler is done the borrow is cleared, so we can discard data from the original reader)cc @jbr
It'd be something like this: