Is your feature request related to a problem? Please describe.
BodyTrait is a Stream that references state that outlives invocation of serve_connection.
loop {
let (stream, _) = listener.accept().await?;
let io = hyper_util::rt::TokioIo::new(stream);
let local_state = state.clone();
tokio::task::spawn(async move {
if let Err(err) = hyper::server::conn::http1::Builder::new()
.serve_connection(
io,
hyper::service::service_fn(async |request| {
api::root_handler(&local_state, request).await
}),
)
.await
{
eprintln!("Error serving connection: {:?}", err);
};
});
}
Describe the solution you'd like
Replace static with named body lifetime parameter
Solution is already implemented in pr: #4045, corresponding necessary changes in hyper-util are in this pr: hyperium/hyper-util#278
Is your feature request related to a problem? Please describe.
BodyTrait is a Stream that references state that outlives invocation of serve_connection.
Describe the solution you'd like
Replace static with named body lifetime parameter
Solution is already implemented in pr: #4045, corresponding necessary changes in hyper-util are in this pr: hyperium/hyper-util#278