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

Relax body requirements by removing 'static bound #3752

Open
nanoqsh opened this issue Sep 11, 2024 · 0 comments
Open

Relax body requirements by removing 'static bound #3752

nanoqsh opened this issue Sep 11, 2024 · 0 comments
Labels
C-feature Category: feature. This is adding a new feature.

Comments

@nanoqsh
Copy link

nanoqsh commented Sep 11, 2024

For now to send any requests you need request's body to be 'static: handshake

I think this restriction is unnecessary for many async runtimes that allow borrowing external environment. My proposal is to remove this restriction, allowing types such as Full<&'a [u8]> to be used as a body. Besides, it may simplify the public API a little bit.

This can be done for http1. But the implementation of the http2 requires a downcasting of body's Data, so it must be 'static. Anyway, even <B as Body>::Data: 'static is less restrictive than B: Body + 'static, it allows to use some borrowed body that produces static chunks of data. I'm not sure if it's possible to relax this restriction too. Maybe something can be invented in the future

@nanoqsh nanoqsh added the C-feature Category: feature. This is adding a new feature. label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature. This is adding a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant