sync: fix watch wrapper (#3914)

This commit is contained in:
Alice Ryhl
2021-07-02 23:24:02 +02:00
committed by GitHub
parent 677107d8d9
commit 8170e2787c
3 changed files with 30 additions and 3 deletions
+2 -2
View File
@@ -72,10 +72,10 @@ impl<T: Clone + 'static + Send + Sync> Stream for WatchStream<T> {
type Item = T;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let (result, rx) = ready!(self.inner.poll(cx));
let (result, mut rx) = ready!(self.inner.poll(cx));
match result {
Ok(_) => {
let received = (*rx.borrow()).clone();
let received = (*rx.borrow_and_update()).clone();
self.inner.set(make_future(rx));
Poll::Ready(Some(received))
}