1 | use std::{ |
---|---|
2 | convert::Infallible, |
3 | task::{Context, Poll}, |
4 | }; |
5 | |
6 | /// A function to help "yield" a future, such that it is re-scheduled immediately. |
7 | /// |
8 | /// Useful for spin counts, so a future doesn't hog too much time. |
9 | pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<Infallible> { |
10 | cx.waker().wake_by_ref(); |
11 | Poll::Pending |
12 | } |
13 |