Function futures_lite::future::yield_now

source ·
pub fn yield_now() -> YieldNow 
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;