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

Remove the need for sync on stream methods #2205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MatMaul
Copy link

@MatMaul MatMaul commented Mar 24, 2024

This makes reqwest body stream compatible with Axum body stream.

@@ -327,7 +327,6 @@ fn _assert_impls() {
assert_sync::<Error>();

assert_send::<Body>();
assert_sync::<Body>();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this would be a breaking change :(

Copy link
Author

@MatMaul MatMaul Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? I am not a Rust pro so I am probably wrong, but since I am removing a trait constraint to a parameter I was expecting this to be fine ?
Since all structs implementing TryStream+Send+Sync will implement TryStream+Send.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all structs implementing TryStream+Send+Sync will implement TryStream+Send.

Absolutely, but remember that Body isn't just an input for requests; it's also an output for response. Removing Sync from Body would disrupt users who rely on the body being Sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants