opentitanlib::test_utils::poll

Function poll_until

Source
pub fn poll_until<F>(timeout: Duration, delay: Duration, f: F) -> Result<()>
where F: FnMut() -> Result<bool>,
Expand description

Poll some operation until it returns true or a timeout is hit.

The provided function should return Some(x) when the condition is met, or None to continue polling.

delay can be used to prevent retrying the operation too frequently.