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 Sync requirement from response bodies #440

Merged
merged 1 commit into from
Nov 1, 2021
Merged

Conversation

davidpdrsn
Copy link
Member

As we learned in Tonic bodies don't need to be Sync because they can
only be polled from one thread at a time.

This changes axum's bodies to no longer require Sync and makes
BoxBody an alias for UnsyncBoxBody<Bytes, axum::Error>.

Also cleans up some body error trait bounds and a few misc other bounds
I noticed while cleaning this up.

As we learned [in Tonic] bodies don't need to be `Sync` because they can
only be polled from one thread at a time.

This changes axum's bodies to no longer require `Sync` and makes
`BoxBody` an alias for `UnsyncBoxBody<Bytes, axum::Error>`.

[in Tonic]: hyperium/tonic#117
ResBody: http_body::Body<Data = Bytes> + Send + Sync + 'static,
ResBody::Error: Into<BoxError> + Send + Sync + 'static,
ResBody: http_body::Body<Data = Bytes> + Send + 'static,
ResBody::Error: Into<BoxError>,
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

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.

2 participants