Function futures_lite::future::yield_now[][src]

pub fn yield_now() -> YieldNow

Notable traits for YieldNow

impl Future for YieldNow type Output = ();

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;