pub trait YieldNow {
    // Provided method
    fn yield_now(&self) -> YieldNowFut  { ... }
}
Expand description

Trait indicating that tasks can yield to the executor. This put’s the current task at the back of the schedulers queue, giving other tasks a chance to run.

In practice for most executors this just returns a future that will, the first time it is polled, wake up the waker and then return Pending.

The problem with using the executors native implementation is that they generally return an opaque future we would have to box.

Provided Methods§

source

fn yield_now(&self) -> YieldNowFut

Await this future in order to yield to the executor.

Implementations on Foreign Types§

source§

impl<YN: YieldNow + ?Sized> YieldNow for &YN

source§

impl<T> YieldNow for WithDispatch<T>where T: YieldNow,

Available on crate feature tracing only.
source§

impl<YN: YieldNow> YieldNow for Box<YN>

source§

impl<T> YieldNow for Instrumented<T>where T: YieldNow,

Available on crate feature tracing only.
source§

impl<YN: YieldNow + ?Sized> YieldNow for Arc<YN>

source§

impl<YN: YieldNow + ?Sized> YieldNow for &mut YN

source§

impl<YN: YieldNow + ?Sized> YieldNow for Rc<YN>

Implementors§