Skip to content

Commit

Permalink
Document safety for Keyed Stream implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus-consoli committed Mar 24, 2024
1 parent f7273aa commit 7850457
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/stream/stream_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ impl<S: Stream> Stream for Keyed<S> {

fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let mut this = self.project();
// todo: unsafe
// SAFETY: pin-projecting to the inner group is safe because we trust
// it that it's correctly pinned
let inner = unsafe { this.group.as_mut().map_unchecked_mut(|t| &mut t.inner) };
inner.poll_next_inner(cx)
}
Expand Down

0 comments on commit 7850457

Please sign in to comment.