feat(core): Stream extension trait - #1214
Open
lcian wants to merge 11 commits into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
lcian
commented
Jun 30, 2026
| fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { | ||
| let hub = self.hub.clone(); | ||
| // https://doc.rust-lang.org/std/pin/index.html#pinning-is-structural-for-field | ||
| let stream = unsafe { self.map_unchecked_mut(|s| &mut s.stream) }; |
Member
Author
There was a problem hiding this comment.
It is possible to avoid this direct usage of unsafe (and the one in SentryFuture) by adding a dependency to pin-project-lite.
Member
|
@lcian what is the status with this PR? Is it abandoned or are you still planning to finish it and get it ready for review? |
lcian
marked this pull request as ready for review
August 3, 2026 11:12
Member
Author
|
@szokeasaurusrex it's ready for review now, please take a look whenever you have time. I don't need this at the moment but it came up a couple times, so I think it would be a nice utility to have. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds an extension trait for
futures_core::Streamthat can be used to.bind_hub(...)on a stream, much like the existing machinery we have for futures.This came up a few times already, and it happens to be one of the ways one could work around #1208 (given that the problematic response body is a stream, one can use such a stream wrapper to bind the current hub before converting that stream to a response -- I still think a proper separate fix should be introduced in the
sentry-towerinstrumentation though, as the user should not have to remember to do this manually. This is a more general construct that can be used in other scenarios too.