Files
hyper/src/common/task.rs
Sean McArthur 8f4b05ae78 feat(lib): update to std::future::Future
BREAKING CHANGE: All usage of async traits (`Future`, `Stream`,
`AsyncRead`, `AsyncWrite`, etc) are updated to newer versions.
2019-07-09 15:55:22 -07:00

11 lines
325 B
Rust

pub(crate) use std::task::{Context, Poll};
use super::Never;
/// A function to help "yield" a future, such that it is re-scheduled immediately.
///
/// Useful for spin counts, so a future doesn't hog too much time.
pub(crate) fn yield_now(cx: &mut Context) -> Poll<Never> {
cx.waker().wake_by_ref();
Poll::Pending
}