I think it is convenient if implementing Body for h2::RecvStreamBody as default, because we get http::Request<h2::RecvStream> when we use h2 to handle HTTP2 requests.
impl Body for h2::RecvStream {
type Data = Bytes;
type Error = h2::Error;
fn poll_data(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Data, Self::Error>>> {
return self.poll_data(cx);
}
fn poll_trailers(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Option<HeaderMap>, Self::Error>> {
return self.poll_trailers(cx);
}
}