Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove 'static bounds for client's body #3755

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ pub struct Parts<T> {
pub struct Connection<T, B>
where
T: Read + Write,
B: Body + 'static,
B: Body,
{
inner: Dispatcher<T, B>,
}

impl<T, B> Connection<T, B>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Return the inner IO object, and additional information.
Expand Down Expand Up @@ -127,7 +127,7 @@ pub struct Builder {
pub async fn handshake<T, B>(io: T) -> crate::Result<(SendRequest<B>, Connection<T, B>)>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand Down Expand Up @@ -170,7 +170,7 @@ impl<B> SendRequest<B> {

impl<B> SendRequest<B>
where
B: Body + 'static,
B: Body,
{
/// Sends a `Request` on the associated connection.
///
Expand Down Expand Up @@ -255,7 +255,7 @@ impl<B> fmt::Debug for SendRequest<B> {
impl<T, B> Connection<T, B>
where
T: Read + Write + Unpin + Send,
B: Body + 'static,
B: Body,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Enable this connection to support higher-level HTTP upgrades.
Expand All @@ -269,7 +269,7 @@ where
impl<T, B> fmt::Debug for Connection<T, B>
where
T: Read + Write + fmt::Debug,
B: Body + 'static,
B: Body,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Connection").finish()
Expand All @@ -279,7 +279,7 @@ where
impl<T, B> Future for Connection<T, B>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand Down Expand Up @@ -517,7 +517,7 @@ impl Builder {
) -> impl Future<Output = crate::Result<(SendRequest<B>, Connection<T, B>)>>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand Down Expand Up @@ -581,7 +581,7 @@ mod upgrades {
pub struct UpgradeableConnection<T, B>
where
T: Read + Write + Unpin + Send + 'static,
B: Body + 'static,
B: Body,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
pub(super) inner: Option<Connection<T, B>>,
Expand All @@ -590,7 +590,7 @@ mod upgrades {
impl<I, B> Future for UpgradeableConnection<I, B>
where
I: Read + Write + Unpin + Send + 'static,
B: Body + 'static,
B: Body,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Expand Down
14 changes: 7 additions & 7 deletions src/client/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<B> Clone for SendRequest<B> {
pub struct Connection<T, B, E>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn Error + Send + Sync>>,
{
Expand Down Expand Up @@ -73,8 +73,8 @@ pub async fn handshake<E, T, B>(
) -> crate::Result<(SendRequest<B>, Connection<T, B, E>)>
where
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B: Body,
B::Data: Send + 'static,
B::Error: Into<Box<dyn Error + Send + Sync>>,
E: Http2ClientConnExec<B, T> + Unpin + Clone,
{
Expand Down Expand Up @@ -121,7 +121,7 @@ impl<B> SendRequest<B> {

impl<B> SendRequest<B>
where
B: Body + 'static,
B: Body,
{
/// Sends a `Request` on the associated connection.
///
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<B> fmt::Debug for SendRequest<B> {
impl<T, B, E> Connection<T, B, E>
where
T: Read + Write + Unpin + 'static,
B: Body + Unpin + 'static,
B: Body + Unpin,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
E: Http2ClientConnExec<B, T> + Unpin,
Expand Down Expand Up @@ -476,8 +476,8 @@ where
) -> impl Future<Output = crate::Result<(SendRequest<B>, Connection<T, B, Ex>)>>
where
T: Read + Write + Unpin,
B: Body + 'static,
B::Data: Send,
B: Body,
B::Data: Send + 'static,
B::Error: Into<Box<dyn Error + Send + Sync>>,
Ex: Http2ClientConnExec<B, T> + Unpin,
{
Expand Down
4 changes: 2 additions & 2 deletions src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ pin_project! {
pub struct SendWhen<B>
where
B: Body,
B: 'static,
{
#[pin]
pub(crate) when: ResponseFutMap<B>,
Expand All @@ -327,7 +326,8 @@ pin_project! {
#[cfg(feature = "http2")]
impl<B> Future for SendWhen<B>
where
B: Body + 'static,
B: Body,
B::Data: 'static,
{
type Output = ();

Expand Down
4 changes: 2 additions & 2 deletions src/proto/h1/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
D::PollError: Into<Box<dyn StdError + Send + Sync>>,
I: Read + Write + Unpin,
T: Http1Transaction + Unpin,
Bs: Body + 'static,
Bs: Body,
Bs::Error: Into<Box<dyn StdError + Send + Sync>>,
{
pub(crate) fn new(dispatch: D, conn: Conn<I, Bs::Data, T>) -> Self {
Expand Down Expand Up @@ -461,7 +461,7 @@ where
D::PollError: Into<Box<dyn StdError + Send + Sync>>,
I: Read + Write + Unpin,
T: Http1Transaction + Unpin,
Bs: Body + 'static,
Bs: Body,
Bs::Error: Into<Box<dyn StdError + Send + Sync>>,
{
type Output = crate::Result<Dispatched>;
Expand Down
16 changes: 8 additions & 8 deletions src/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub(crate) async fn handshake<T, B, E>(
) -> crate::Result<ClientTask<B, E, T>>
where
T: Read + Write + Unpin,
B: Body + 'static,
B: Body,
B::Data: Send + 'static,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
Expand Down Expand Up @@ -363,7 +363,6 @@ pin_project! {
pub enum H2ClientFuture<B, T>
where
B: http_body::Body,
B: 'static,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
T: Read,
T: Write,
Expand All @@ -386,7 +385,8 @@ pin_project! {

impl<B, T> Future for H2ClientFuture<B, T>
where
B: http_body::Body + 'static,
B: http_body::Body,
B::Data: 'static,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
T: Read + Write + Unpin,
{
Expand Down Expand Up @@ -434,7 +434,7 @@ where

impl<B, E, T> ClientTask<B, E, T>
where
B: Body + 'static,
B: Body,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
T: Read + Write + Unpin,
Expand Down Expand Up @@ -485,7 +485,7 @@ where

impl<B, E, T> ClientTask<B, E, T>
where
B: Body + 'static + Unpin,
B: Body + Unpin,
B::Data: Send,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
Expand Down Expand Up @@ -543,7 +543,6 @@ pin_project! {
pub(crate) struct ResponseFutMap<B>
where
B: Body,
B: 'static,
{
#[pin]
fut: ResponseFuture,
Expand All @@ -556,7 +555,8 @@ pin_project! {

impl<B> Future for ResponseFutMap<B>
where
B: Body + 'static,
B: Body,
B::Data: 'static,
{
type Output = Result<Response<crate::body::Incoming>, (crate::Error, Option<Request<B>>)>;

Expand Down Expand Up @@ -620,7 +620,7 @@ where

impl<B, E, T> Future for ClientTask<B, E, T>
where
B: Body + 'static + Unpin,
B: Body + Unpin,
B::Data: Send,
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
E: Http2ClientConnExec<B, T> + Unpin,
Expand Down
Loading