Skip to content

Commit 1919a88

Browse files
author
zetanumbers
committed
Add poll_once for Runloop
1 parent 085f17d commit 1919a88

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/runtime/runloop.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ where
7373
self.inner.force()
7474
}
7575

76+
/// TODO description
77+
pub fn poll_once(&mut self) -> Poll<Out> {
78+
self.inner.poll_once(&mut self.root)
79+
}
80+
81+
/// TODO description
82+
pub fn poll_once_with(&mut self, waker: Waker) -> Poll<Out> {
83+
self.inner.poll_once_with(&mut self.root, waker)
84+
}
85+
7686
/// Poll this runtime without exiting. Discards any value returned from the
7787
/// root function. The future yields in between revisions and is woken on
7888
/// state changes.
@@ -98,6 +108,6 @@ where
98108
/// `poll_next`, always returning `Poll::Ready(Some(...))`.
99109
fn poll_next(self: Pin<&mut Self>, cx: &mut FutContext<'_>) -> Poll<Option<Self::Item>> {
100110
let this = self.get_mut();
101-
this.inner.poll_once_with(&mut this.root, cx.waker().clone()).map(Some)
111+
this.poll_once_with(cx.waker().clone()).map(Some)
102112
}
103113
}

0 commit comments

Comments
 (0)