pub fn run_with_wake<F>(future: F, wait: impl FnMut(), wake: fn()) -> F::Outputwhere
F: Future,Expand description
Runs the provided future until polling succeeds, calling the provided wait closure in between
each polling attempt.
When this thread is supposed to wake up again, the provided wake closure will be called. This
allows the user to provide custom “unpark” functionality, if necessary.
A common pattern is to let wait simply be some delay function (like sleep()), or in certain
environments (such as on embedded devices), it might make sense to call wfi to wait for
peripheral interrupts, if you know that to be the source of future completion.