pub fn yield_now() -> YieldNowNotable traits for YieldNowimpl Future for YieldNow    type Output = ();
Expand description

Wakes the current task and returns Poll::Pending once.

This function is useful when we want to cooperatively give time to the task scheduler. It is generally a good idea to yield inside loops because that way we make sure long-running tasks don’t prevent other tasks from running.

Examples

use futures_lite::future;

future::yield_now().await;