Skip to main content

poll_until

Function poll_until 

Source
pub async fn poll_until<T, F, Fut>(
    what: impl Display + Send,
    poll: F,
) -> Result<T>
where F: FnMut() -> Fut, Fut: Future<Output = Result<Option<T>>>,
Expand description

Calls poll every POLL_INTERVAL until it returns a value.

Returns an error describing what was awaited if the condition is not met within WAIT_TIMEOUT, or the first error returned by poll.

what is held across awaits, so it must be Send for the returned future to be Send. This rules out format_args!, use format! instead.