Skip to content

Commit

Permalink
Update src/future.rs
Browse files Browse the repository at this point in the history
Co-authored-by: John Nunley <jtnunley01@gmail.com>
  • Loading branch information
GlenDC and notgull authored May 10, 2024
1 parent b9f736d commit e33ebe5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,14 @@ impl<Fut: Future> Future for Fuse<Fut> {
type Output = Fut::Output;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Fut::Output> {
self.as_mut()
.project()
.inner
.as_pin_mut()
.map(|f| f.poll(cx))
.unwrap_or(Poll::Pending)
.map(|output| {
match self.as_mut().project().inner.as_pin_mut().map(|f| f.poll(cx)) {
Some(Poll::Ready(output)) => {
self.project().inner.set(None);
output
})
Poll::Ready(output)
}

Some(Poll::Pending) | None => Poll::Pending
}
}
}

Expand Down

0 comments on commit e33ebe5

Please sign in to comment.